Search Results

Search found 154 results on 7 pages for 'rim 4 7'.

Page 3/7 | < Previous Page | 1 2 3 4 5 6 7  | Next Page >

  • BlackBerry/J2ME - SAX parse collection of objects with attributes

    - by Changqi Guo
    I have a problem with using the SAX parser to parse a XML file. It is a complex XML file, it is like the following. <Objects> <Object no="1"> <field name="PID">ilives:87877</field> <field name="dc.coverage">Charlottetown</field> <field name="fgs.ownerId">fedoraAdmin</field> </Object> <Object no="2">...... I am confused how to get the names in each field, and how to store the information of each object. import java.util.Enumeration; import java.util.Hashtable; public class XMLObject { private Hashtable mFields = new Hashtable(); private int mN = -1; public int getN() { return mN; } public void setN(int n) { mN = n; } public String getStringField(String key) { return (String) mFields.get(key); } public void setStringField(String key, String value) { mFields.put(key, value); } public String getPID() { return getStringField("PID"); } public void setPID(String pid) { setStringField("PID", pid); } public String getDcCoverage() { return getStringField("dc.coverage"); } public void setDcCoverage(String dcCoverage) { setStringField("dc.coverage", dcCoverage); } public String getFgsOwnerId() { return getStringField("fgs.ownerId"); } public void setFgsOwnerId(String fgsOwnerId) { setStringField("fgs.ownerId", fgsOwnerId); } public String dccreator() { return getStringField("dc.creator"); } public void dccreator(String dccreator) { setStringField("dc.creator", dccreator); } public String getdcformat() { return getStringField("dc.format"); } public void setdcformat(String dcformat) { setStringField("dc.format", dcformat); } public String getdcidentifier() { return getStringField("dc.identifier"); } public void setdcidentifier(String dcidentifier) { setStringField("dc.identifier", dcidentifier); } public String getdclanguage() { return getStringField("dc.language"); } public void setdclanguage(String dclanguage) { setStringField("dc.language", dclanguage); } public String getdcpublisher() { return getStringField("dc.publisher"); } public void setdcpublisher(String dcpublisher) { setStringField("dc.publisher",dcpublisher); } public String getdcsubject() { return getStringField("dc.subject"); } public void setdcsubject(String dcsubject) { setStringField("dc.subject",dcsubject); } public String getdctitle() { return getStringField("dc.title"); } public void setdctitle(String dctitle) { setStringField("dc.title",dctitle); } public String getdctype() { return getStringField("dc.type"); } public void setdctype(String dctype) { setStringField("dc.type",dctype); } public String toString() { StringBuffer sb = new StringBuffer(); sb.append("N:"+mN+";"); Enumeration keys = mFields.keys(); while (keys.hasMoreElements()) { String key = (String) keys.nextElement(); sb.append(key+":"+mFields.get(key)+";"); } return sb.toString(); } } i used the same handler class you provided import java.io.*; import net.rim.device.api.system.Bitmap; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import java.io.InputStream; import net.rim.device.api.ui.component.*; import net.rim.device.api.ui.container.MainScreen; import net.rim.device.api.xml.parsers.*; import org.w3c.dom.*; import org.xml.sax.*; import org.xml.sax.helpers.DefaultHandler; public class xmlparsermainscreen extends MainScreen{ private static String xmlres = "/xml/xml1.xml"; private RichTextField textOutputField; public xmlparsermainscreen() throws ParserConfigurationException, net.rim.device.api.xml.parsers.ParserConfigurationException, IOException { InputStream inputStream = getClass().getResourceAsStream(xmlres); ByteArrayOutputStream baos = new ByteArrayOutputStream(); byte[] buffer = new byte[10000]; int bytesRead = inputStream.read(buffer); while (bytesRead > 0) { baos.write(buffer, 0, bytesRead); bytesRead = inputStream.read(buffer); } baos.close(); String result=baos.toString(); ByteArrayInputStream bais = new ByteArrayInputStream(result.getBytes()); XMLObject[] xmlObjects = getXMLObjects(bais); for (int i = 0; i < xmlObjects.length; i++) { XMLObject o = xmlObjects[i]; textOutputField = new RichTextField(); add(textOutputField); textOutputField.setText(o.toString()); // add(new LabelField(o.toString())); } LabelField resultdis=new LabelField("resultdisplay"); add(resultdis); //textOutputField = new RichTextField(); //add(textOutputField); //textOutputField.setText(result); } static XMLObject[] getXMLObjects(InputStream is) throws ParserConfigurationException { XMLObjectHandler xmlObjectHandler = new XMLObjectHandler(); try { SAXParser parser = SAXParserFactory.newInstance() .newSAXParser(); parser.parse(is, xmlObjectHandler); } catch (ParserConfigurationException e) { e.printStackTrace(); } catch (SAXException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return xmlObjectHandler.getXMLObjects(); } } import java.io.IOException; import javax.xml.parsers.ParserConfigurationException; import net.rim.device.api.ui.UiApplication; public class xmlparser extends UiApplication { private xmlparser() throws ParserConfigurationException, net.rim.device.api.xml.parsers.ParserConfigurationException, IOException { pushScreen( new xmlparsermainscreen() ); } public static void main( String[] args ) throws ParserConfigurationException, net.rim.device.api.xml.parsers.ParserConfigurationException, IOException { new xmlparser().enterEventDispatcher(); } }

    Read the article

  • BlackBerry 10 en images (7/9) : BlackBerry Hub, le Centre de Communication du téléphone

    BlackBerry 10 en images (1/9) : BlackBerry Flow RIM dévoile les nouveautés au compte-goutte et promet de très grosses surprises Deux jours après les annonces officielles du PDG de RIM, la filiale Française nous a conviés à une démonstration pour nous dévoiler « en vrai » quelques nouveautés supplémentaires de son prochain BlackBerry 10. « Son plus gros lancement de tous les temps », selon David Derrida, le responsable produit. Les voici en images au moment où le code est officiellement gelé. BlackBerry Flow C'est la nouvelle manière d'interagir avec l'OS. ...

    Read the article

  • BlackBerry 10 en images (4/9) : la Home, des vignettes dynamiques mais pas personnalisables

    BlackBerry 10 en images (1/9) : BlackBerry Flow RIM dévoile les nouveautés au compte-goutte et promet de très grosses surprises Deux jours après les annonces officielles du PDG de RIM, la filiale Française nous a conviés à une démonstration pour nous dévoiler « en vrai » quelques nouveautés supplémentaires de son prochain BlackBerry 10. « Son plus gros lancement de tous les temps », selon David Derrida, le responsable produit. Les voici en images au moment où le code est officiellement gelé. BlackBerry Flow C'est la nouvelle manière d'interagir avec l'OS. ...

    Read the article

  • BlackBerry 10 en images (6/9) : le navigateur champion toutes catégories du HTML5 ?

    BlackBerry 10 en images (1/9) : BlackBerry Flow RIM dévoile les nouveautés au compte-goutte et promet de très grosses surprises Deux jours après les annonces officielles du PDG de RIM, la filiale Française nous a conviés à une démonstration pour nous dévoiler « en vrai » quelques nouveautés supplémentaires de son prochain BlackBerry 10. « Son plus gros lancement de tous les temps », selon David Derrida, le responsable produit. Les voici en images au moment où le code est officiellement gelé. BlackBerry Flow C'est la nouvelle manière d'interagir avec l'OS. ...

    Read the article

  • BlackBerry 10 en images (5/9) : le clavier apprenant complétif et prédictif à auto-detection multilingue, en fait c'est simple

    BlackBerry 10 en images (1/9) : BlackBerry Flow RIM dévoile les nouveautés au compte-goutte et promet de très grosses surprises Deux jours après les annonces officielles du PDG de RIM, la filiale Française nous a conviés à une démonstration pour nous dévoiler « en vrai » quelques nouveautés supplémentaires de son prochain BlackBerry 10. « Son plus gros lancement de tous les temps », selon David Derrida, le responsable produit. Les voici en images au moment où le code est officiellement gelé. BlackBerry Flow C'est la nouvelle manière d'interagir avec l'OS. ...

    Read the article

  • BlackBerry 10 en images (8/9) : un téléphone ? Non, six ! A tous les prix, avec et sans clavier

    BlackBerry 10 en images (1/9) : BlackBerry Flow RIM dévoile les nouveautés au compte-goutte et promet de très grosses surprises Deux jours après les annonces officielles du PDG de RIM, la filiale Française nous a conviés à une démonstration pour nous dévoiler « en vrai » quelques nouveautés supplémentaires de son prochain BlackBerry 10. « Son plus gros lancement de tous les temps », selon David Derrida, le responsable produit. Les voici en images au moment où le code est officiellement gelé. BlackBerry Flow C'est la nouvelle manière d'interagir avec l'OS. ...

    Read the article

  • BlackBerry 10 en images (2/9) : Pick, un glisser de la gauche pour ne pas sortir des applications

    BlackBerry 10 en images (1/9) : BlackBerry Flow RIM dévoile les nouveautés au compte-goutte et promet de très grosses surprises Deux jours après les annonces officielles du PDG de RIM, la filiale Française nous a conviés à une démonstration pour nous dévoiler « en vrai » quelques nouveautés supplémentaires de son prochain BlackBerry 10. « Son plus gros lancement de tous les temps », selon David Derrida, le responsable produit. Les voici en images au moment où le code est officiellement gelé. BlackBerry Flow C'est la nouvelle manière d'interagir avec l'OS. ...

    Read the article

  • BlackBerry 10 en images (3/9) : BlackBerry Balance, une session Pro et une session privée hermétiquement séparées

    BlackBerry 10 en images (1/9) : BlackBerry Flow RIM dévoile les nouveautés au compte-goutte et promet de très grosses surprises Deux jours après les annonces officielles du PDG de RIM, la filiale Française nous a conviés à une démonstration pour nous dévoiler « en vrai » quelques nouveautés supplémentaires de son prochain BlackBerry 10. « Son plus gros lancement de tous les temps », selon David Derrida, le responsable produit. Les voici en images au moment où le code est officiellement gelé. BlackBerry Flow C'est la nouvelle manière d'interagir avec l'OS. ...

    Read the article

  • how httpregistryfilter() in blackberry works?how to use [closed]

    - by Sowjanya
    i am trying to start my application using an url in my device browser. for this i used this: HttpFilterRegistry.registerFilter("www.atsas23.com","com.rim.samples.device.push"); Here this method will registry my application with www.atsas23.com and the second one will call the protocol class ,which is their in com.rim.samples.device.push. Now after doing ,still i am not getting .Means my app is not opening in browser.Can anybody tell why my application is not registering.what is going wrong.

    Read the article

  • 907 Invalid Jar Midlet Class is not public: autostartup

    - by vajapravin
    I am developing blackberry app. I use eclipse. When I run app from eclipse it runs well on device. But when I run it on manually installed - copy web and standard folders to my device memory and run jar file it gives me 907 invalid jar... my .cod file is Manifest-Version: 1.0 MIDlet-Jar-Size: 65712 MicroEdition-Configuration: CLDC-1.1 MIDlet-Version: 0.0.1 MIDlet-Name: app_blackberry_6 RIM-COD-Size: 61852 RIM-COD-URL-69: App1.cod RIM-COD-URL-68: App2.cod ...and I have also tried to change size of MIDlet-Jar-Size: 0 but is not working.

    Read the article

  • Persistence store in blackberry

    - by arunabha
    i am trying to save a simple string value "1".If i go back from one screen to another,its saving,but when i exit the app,and start again,i dont see that value being saved.I am implementing persistable interface.Can anyone suggest me where i am getting wrong import net.rim.device.api.util.Persistable; import net.rim.device.api.system.PersistentObject; import net.rim.device.api.system.PersistentStore; public class Persist implements Persistable { public static PersistentObject abc; public static String b; static { abc = PersistentStore.getPersistentObject(0xb92c8fe20b256b82L); } public static void data(){ synchronized (abc) { abc.setContents(1+""); abc.commit(); } } public static String getCurrQuestionNumber() { synchronized (abc) { System.out.println("new title is"+b); b= (String)abc.getContents(); System.out.println("title is"+b); return b; } } }

    Read the article

  • Blackberry OS 7.1 ouvre BBM aux développeurs pour « créer de la viralité » autour de leurs applications, des API pour le NFC

    Blackberry OS 7.1 ouvre BBM aux développeurs Pour « créer de la viralité» autour de leurs applications, des API pour le NFC Research In Motion ne va pas bien financièrement, mais RIM n'est pas mort pour autant. L'annonce de la version 7.1 de son BlackBerry OS montre en effet que le canadien est toujours prêt à se battre. Comment ? En étant toujours une référence pour les professionnels (support de tout type de messagerie, de protocoles et d'outils ? d'Exchange à SAP en passant par Lync de Microsoft ou les technologies de Cisco) et en donnant de nouveaux outils aux développeurs. [IMG]http://ftp-developpez.com/gordon-fowler/BBPlateforme.png[/IMG] RIM a par exemple fai...

    Read the article

  • Blackberry XML Parsing Application not working

    - by Nirmal
    Hello All... I found one sample application from the Blackberry knowledgebase. From that application I have put that sample application on my eclipse plugin, and the code is as follows : import javax.microedition.io.*; import net.rim.device.api.ui.*; import net.rim.device.api.ui.component.*; import net.rim.device.api.ui.container.*; import net.rim.device.api.system.*; import net.rim.device.api.xml.parsers.*; import org.w3c.dom.*; import org.xml.sax.*; class XML_Parsing_Sample extends UiApplication { // creating a member variable for the MainScreen MainScreen _screen = new MainScreen(); // string variables to store the values of the XML document String _node, _element; Connection _connectionthread; public static void main(String arg[]) { XML_Parsing_Sample application = new XML_Parsing_Sample(); // create a new instance of the application // and start the application on the event thread application.enterEventDispatcher(); } public XML_Parsing_Sample() { _screen.setTitle("XML Parsing");// setting title _screen.add(new RichTextField("Requesting.....")); _screen.add(new SeparatorField()); pushScreen(_screen); // creating a screen // creating a connection thread to run in the background _connectionthread = new Connection(); _connectionthread.start();// starting the thread operation } public void updateField(String node, String element) { // receiving the parsed node and its value from the thread // and updating it here // so it can be displayed on the screen String title = "My App"; _screen.add(new RichTextField(node + " : " + element)); if (node.equals(title)) { _screen.add(new SeparatorField()); } } private class Connection extends Thread { public Connection() { super(); } public void run() { // define variables later used for parsing Document doc; StreamConnection conn; try { // providing the location of the XML file, // your address might be different conn = (StreamConnection) Connector .open("http://www.sufalamtech.com/demo/moviewebservice/Test.xml"); // next few lines creates variables to open a // stream, parse it, collect XML data and // extract the data which is required. // In this case they are elements, // node and the values of an element DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory .newInstance(); DocumentBuilder docBuilder = docBuilderFactory .newDocumentBuilder(); docBuilder.isValidating(); doc = docBuilder.parse(conn.openInputStream()); doc.getDocumentElement().normalize(); NodeList list = doc.getElementsByTagName("*"); _node = new String(); _element = new String(); // this "for" loop is used to parse through the // XML document and extract all elements and their // value, so they can be displayed on the device for (int i = 0; i < list.getLength(); i++) { Node value = list.item(i).getChildNodes().item(0); _node = list.item(i).getNodeName(); _element = value.getNodeValue(); updateField(_node, _element); }// end for }// end try // will catch any exception thrown by the XML parser catch (Exception e) { Dialog.alert("exception = " + e); } }// end connection function }// end connection class }// end XML_Parsing_Sample But when I am running this application, the simulator just showing me a Blank screen with label Requesting... Anybody help me out for this ? Thanks in advance...

    Read the article

  • not able to install signature keys

    - by Aman
    Hi , I have to sign an blackberry application so that i can load it to the device but, the signature keys i got from the RIM are installed on the system gets formatted and now i am trying to install the signature keys on another system but the server prompts me for this "Unable to register client'2909103544'because there are no more registration attempts.If you have already registered with this server,then you must contact RIM to register additional user" Can we install these keys to only single computer or now i had to purchase new keys

    Read the article

  • Blackberry how to display message in app if device got no internet connection?

    - by Johannes
    Hello I've just started with programming for the Blackberry device. I'm using version 5 of the API. I'm building a very simple application which is just a browserfield. So far it's all working great. I can display my browserfield with the content I need. The problem I'm having now is if the device doesn't have an active internet connection I get the ugly "Error requesting content for" message. I would need to someone display my own message if the device doesn't have an active connection. Something like "You need to have an active internet connection to use this application" with an Exit button which closes the app. I've tried to find this for hours but no luck. Hopefully it's something relatively easy so I can get help here. Here's my code so far: package com.mycompany.webview; import net.rim.device.api.browser.field2.*; import net.rim.device.api.ui.*; import net.rim.device.api.ui.container.*; public class webview extends UiApplication { public static void main(String[] args) { webview app = new webview(); app.enterEventDispatcher(); } public webview() { pushScreen(new webviewScreen()); } } class webviewScreen extends MainScreen { public webviewScreen() { BrowserField myBrowserField = new BrowserField(); add(myBrowserField); myBrowserField.requestContent("http://www.google.com"); } } Would really appreciate some help please. Thanks

    Read the article

  • "pushModalScreen called by a non-event thread" thrown on event thread

    - by JGWeissman
    I am trying to get my Blackberry application to display a custom modal dialog, and have the opening thread wait until the user closes the dialog screen. final Screen dialog = new FullScreen(); ...// Fields are added to dialog Application.getApplication().invokeAndWait(new Runnable() { public void run() { Application.getUiApplication().pushModalScreen(dialog); } }); This is throwing an Exception which says "pushModalScreen called by a non-event thread" despite the fact that I am using invokeAndWait to call pushModalScreen from the event thread. Any ideas about what the real problem is? Here is the code to duplicate this problem: package com.test; import net.rim.device.api.ui.*; import net.rim.device.api.ui.component.*; import net.rim.device.api.ui.container.*; public class Application extends UiApplication { public static void main(String[] args) { new Application(); } private Application() { new Thread() { public void run() { Application.this.enterEventDispatcher(); } }.start(); final Screen dialog = new FullScreen(); final ButtonField closeButton = new ButtonField("Close Dialog"); closeButton.setChangeListener(new FieldChangeListener() { public void fieldChanged(Field field, int context) { Application.getUiApplication().popScreen(dialog); } }); dialog.add(closeButton); Application.getApplication().invokeAndWait(new Runnable() { public void run() { try { Application.getUiApplication().pushModalScreen(dialog); } catch (Exception e) { // To see the Exception in the debugger throw new RuntimeException(e.getMessage()); } } }); System.exit(0); } } I am using Component Package version 4.5.0.

    Read the article

  • Error emailing outgoing sms

    - by BirthOfTragedy
    Is there anyway to listen for an outbound sms without having to import javax.wireless.messaging? I'm trying to write an app that listens for an sms sent from the device then emails the message of the sms, but I get the error: reference to Message is ambiguous, both class javax.wireless.messaging.Message in javax.wireless.messaging and class net.rim.blackberry.api.mail.Message in net.rim.blackberry.api.mail match I need to import net.rim.blackberry.api.mail.Message in order to sent an email. Is there a way to get around this as it seems that the two packages are clashing. My code: public void notifyIncomingMessage(MessageConnection messageconnection) {} public void notifyOutgoingMessage(javax.wireless.messaging.Message message) { try { String address = message.getAddress(); String msg = null; if ( message instanceof TextMessage ) { TextMessage tm = (TextMessage)message; msg = tm.getPayloadText(); } else if (message instanceof BinaryMessage) { StringBuffer buf = new StringBuffer(); byte[] data = ((BinaryMessage) message).getPayloadData(); msg = new String(data, "UTF-8"); Store store = Session.getDefaultInstance().getStore(); Folder[] folders = store.list(Folder.SENT); Folder sentfolder = folders[0]; Message in = new Message(sentfolder); Address recipients[] = new Address[1]; recipients[0]= new Address("[email protected]", "user"); in.addRecipients(Message.RecipientType.TO, recipients); in.setSubject("Outgoing sms"); in.setContent("You have just sent an sms to: " + address + "\n" + "Message: " + msg); in.setPriority(Message.Priority.HIGH); Transport.send(in); in.setFlag(Message.Flag.OPENED, true); Folder folder = in.getFolder(); folder.deleteMessage(in); } } catch (IOException me) { System.out.println(me); } } }

    Read the article

  • How do you traverse and store XML in Blackberry Java app?

    - by Greg
    I'm having a problem accessing the contents of an XML document. My goal is this: Take an XML source and parse it into a fair equivalent of an associative array, then store it as a persistable object. the xml is pretty simple: <root> <element> <category_id>1</category_id> <name>Cars</name> </element> <element> <category_id>2</category_id> <name>Boats</name> </element> </root> Basic java class below. I'm pretty much just calling save(xml) after http response above. Yes, the xml is properly formatted. import java.io.IOException; import java.util.Hashtable; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import java.util.Vector; import net.rim.device.api.system.PersistentObject; import net.rim.device.api.system.PersistentStore; import net.rim.device.api.xml.parsers.DocumentBuilder; import net.rim.device.api.xml.parsers.DocumentBuilderFactory; public class database{ private static PersistentObject storeVenue; static final long key = 0x2ba5f8081f7ef332L; public Hashtable hashtable; public Vector venue_list; String _node,_element; public database() { storeVenue = PersistentStore.getPersistentObject(key); } public void save(Document xml) { venue_list = new Vector(); storeVenue.setContents(venue_list); Hashtable categories = new Hashtable(); try{ DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory. newInstance(); DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder(); docBuilder.isValidating(); xml.getDocumentElement ().normalize (); NodeList list=xml.getElementsByTagName("*"); _node=new String(); _element = new String(); for (int i=0;i<list.getLength();i++){ Node value=list.item(i).getChildNodes().item(0); _node=list.item(i).getNodeName(); _element=value.getNodeValue(); categories.put(_element, _node); } } catch (Exception e){ System.out.println(e.toString()); } venue_list.addElement(categories); storeVenue.commit(); } The code above is the work in progress, and is most likely heavily flawed. However, I have been at this for days now. I can never seem to get all child nodes, or the name / value pair. When I print out the vector as a string, I usually end up with results like this: [{ = root, = element}] and that's it. No "category_id", no "name" Ideally, I would end up with something like [{1 = cars, 2 = boats}] Any help is appreciated. Thanks

    Read the article

  • how to pass a variable value from one class to another

    - by Arunabha
    I have two packages one is com.firstBooks.series.db.parser which have a java file XMLParser.java, I have another package com.firstBooks.series79 which have a class called AppMain.NW I want to send the value of a variable called _xmlFileName frm AppMain class to the xmlFile variable in XMLParser class, I am posting the code for both the class, kindly help me. package com.firstBooks.series.db.parser; import java.io.IOException; import java.io.InputStream; import java.util.Vector; import net.rim.device.api.xml.parsers.DocumentBuilder; import net.rim.device.api.xml.parsers.DocumentBuilderFactory; import net.rim.device.api.xml.parsers.ParserConfigurationException; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; import com.firstBooks.series.db.Question; public class XMLParser { private Document document; public static Vector questionList; public static String xmlFile; public XMLParser() { questionList = new Vector(); } public void parseXMl() throws SAXException, IOException, ParserConfigurationException { // Build a document based on the XML file. DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); InputStream inputStream = getClass().getResourceAsStream(xmlFile); document = builder.parse(inputStream); } public void parseDocument() { Element element = document.getDocumentElement(); NodeList nl = element.getElementsByTagName("question"); if (nl != null && nl.getLength() > 0) { for (int i = 0; i < nl.getLength(); i++) { Element ele = (Element) nl.item(i); Question question = getQuestions(ele); questionList.addElement(question); } } } private Question getQuestions(Element element) { String title = getTextValue(element, "title"); String choice1 = getTextValue(element, "choice1"); String choice2 = getTextValue(element, "choice2"); String choice3 = getTextValue(element, "choice3"); String choice4 = getTextValue(element, "choice4"); String answer = getTextValue(element, "answer"); String rationale = getTextValue(element, "rationale"); Question Questions = new Question(title, choice1, choice2, choice3, choice4, answer, rationale); return Questions; } private String getTextValue(Element ele, String tagName) { String textVal = null; NodeList nl = ele.getElementsByTagName(tagName); if (nl != null && nl.getLength() > 0) { Element el = (Element) nl.item(0); textVal = el.getFirstChild().getNodeValue(); } return textVal; } } Nw the code for AppMain class //#preprocess package com.firstBooks.series79; import net.rim.device.api.ui.UiApplication; import com.firstBooks.series.ui.screens.HomeScreen; public class AppMain extends UiApplication { public static String _xmlFileName; public static boolean _Lite; public static int _totalNumofQuestions; public static void initialize(){ //#ifndef FULL /* //#endif _xmlFileName = "/res/Series79_FULL.xml"; _totalNumofQuestions = 50; _Lite = false; //#ifndef FULL */ //#endif //#ifndef LITE /* //#endif _xmlFileName = "/res/Series79_LITE.xml"; _totalNumofQuestions = 10; _Lite = true; //#ifndef LITE */ //#endif } private AppMain() { initialize(); pushScreen(new HomeScreen()); } public static void main(String args[]) { new AppMain().enterEventDispatcher(); } }

    Read the article

  • how to pass one variable value frm one class to the oder

    - by Arunabha
    i hav two packages one is com.firstBooks.series.db.parser which hav a java file XMLParser.java,i hav another package com.firstBooks.series79 which hav a class called AppMain.NW i want to send the value of a variable called _xmlFileName frm AppMain class to the xmlFile variable in XMLParser class,i am posting the codes for both the class,kindly help me. package com.firstBooks.series.db.parser; import java.io.IOException; import java.io.InputStream; import java.util.Vector; import net.rim.device.api.xml.parsers.DocumentBuilder; import net.rim.device.api.xml.parsers.DocumentBuilderFactory; import net.rim.device.api.xml.parsers.ParserConfigurationException; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; import com.firstBooks.series.db.Question; public class XMLParser { private Document document; public static Vector questionList; public static String xmlFile; public XMLParser() { questionList = new Vector(); } public void parseXMl() throws SAXException, IOException, ParserConfigurationException { // Build a document based on the XML file. DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); InputStream inputStream = getClass().getResourceAsStream(xmlFile); document = builder.parse(inputStream); } public void parseDocument() { Element element = document.getDocumentElement(); NodeList nl = element.getElementsByTagName("question"); if (nl != null && nl.getLength() > 0) { for (int i = 0; i < nl.getLength(); i++) { Element ele = (Element) nl.item(i); Question question = getQuestions(ele); questionList.addElement(question); } } } private Question getQuestions(Element element) { String title = getTextValue(element, "title"); String choice1 = getTextValue(element, "choice1"); String choice2 = getTextValue(element, "choice2"); String choice3 = getTextValue(element, "choice3"); String choice4 = getTextValue(element, "choice4"); String answer = getTextValue(element, "answer"); String rationale = getTextValue(element, "rationale"); Question Questions = new Question(title, choice1, choice2, choice3, choice4, answer, rationale); return Questions; } private String getTextValue(Element ele, String tagName) { String textVal = null; NodeList nl = ele.getElementsByTagName(tagName); if (nl != null && nl.getLength() > 0) { Element el = (Element) nl.item(0); textVal = el.getFirstChild().getNodeValue(); } return textVal; } } Nw the code for AppMain class //#preprocess package com.firstBooks.series79; import net.rim.device.api.ui.UiApplication; import com.firstBooks.series.ui.screens.HomeScreen; public class AppMain extends UiApplication { public static String _xmlFileName; public static boolean _Lite; public static int _totalNumofQuestions; public static void initialize(){ //#ifndef FULL /* //#endif _xmlFileName = "/res/Series79_FULL.xml"; _totalNumofQuestions = 50; _Lite = false; //#ifndef FULL */ //#endif //#ifndef LITE /* //#endif _xmlFileName = "/res/Series79_LITE.xml"; _totalNumofQuestions = 10; _Lite = true; //#ifndef LITE */ //#endif } private AppMain() { initialize(); pushScreen(new HomeScreen()); } public static void main(String args[]) { new AppMain().enterEventDispatcher(); } }

    Read the article

  • Error while trying to deploy blackberry application (Linker Error: 'VerifyError')

    - by Irwin
    Device: Curve 8520 OS: 4.6.1 JDE: 5.0.25 JDK: 1.6 Signed app? Yes. Hello, I'm trying to deploy a blackberry app (called 'ConstituenC') that works fine in the simulator. It uses restricted APIs, so I obtained a key from RIM and applied it via the Java Development Environment. When I attempt to run on my phone (BB Curve, 8520. OS: 4.6.1), it shows an error saying "'ConstituentC' attempts to access a secure API." The following is shown in the BB Event Log: Java Exception: Error starting ConstituentC: Module 'ConstituentC' attempts to access a secure API. Error starting ConstituentC: Module 'ConstituentC' attempts to access a secure API. Linker error: 'VerifyError' for ConstituentC Module 'ConstituentC' attempts to access a secure API module 9621 cannot reference net.rim.blackberry.api.mail.Store CMM: ConstituentC (9621) invalid sig for 0x424252 VM:LINK ConstituentC Any ideas on how this could be resolved?

    Read the article

< Previous Page | 1 2 3 4 5 6 7  | Next Page >