String Array as return value in Java / Android

elgokr

New Member
I am using a SAX XML Parser to get values out of a XML file that works fine. This is the method in my main activity:\[code\]public void parseXML() { String parsedDatahttp://stackoverflow.com/questions/12421159/= ""; try { Log.w("AndroidParseXMLActivity", "Start"); /** Handling XML */ SAXParserFactory spf = SAXParserFactory.newInstance(); SAXParser sp = spf.newSAXParser(); XMLReader xr = sp.getXMLReader(); XMLContentHandler myXMLHandler = new XMLContentHandler(); xr.setContentHandler(myXMLHandler); AssetManager assetManager = getAssets(); InputStream inputStream = null; try { inputStream = assetManager.open("calimero.xml"); } catch (IOException e) { Log.e("tag", e.getMessage()); } xr.parse(new InputSource(inputStream)); ArrayList<Datapoint> itemsList = myXMLHandler.getItemsList(); int datapoint_size = itemsList.size(); String xml_names[] = new String [datapoint_size]; String xml_states[] = new String [datapoint_size]; String xml_dptIDs[] = new String [datapoint_size]; String xml_groupadresses[] = new String [datapoint_size]; String xml_mainNumbers[] = new String [datapoint_size]; for(int i=0;i<itemsList.size();i++){ Datapoint item = itemsList.get(i); parsedData = http://stackoverflow.com/questions/12421159/parsedData +"----->\n"; parsedData = http://stackoverflow.com/questions/12421159/parsedData +"Name: " + item.getName() + "\n"; xml_names = item.getName(); parsedData = http://stackoverflow.com/questions/12421159/parsedData +"stateBased: " + item.getStateBased() + "\n"; xml_states = item.getStateBased(); parsedData = http://stackoverflow.com/questions/12421159/parsedData +"mainNumber: " + item.getMainNumber() + "\n"; xml_mainNumbers = item.getMainNumber(); parsedData = http://stackoverflow.com/questions/12421159/parsedData +"dptID: "+ item.getDptID() + "\n"; xml_dptIDs = item.getDptID(); parsedData = http://stackoverflow.com/questions/12421159/parsedData +"Groupadress: "+ item.getGroupadress() + "\n"; xml_groupadresses = item.getGroupadress(); } Log.w("AndroidParseXMLActivity", "Done"); } catch (Exception e) { Log.w("AndroidParseXMLActivity",e ); } Log.w("AndroidParseXMLActivity", names[0]); Log.w("AndroidParseXMLActivity", mainNumbers[2]); Log.w("AndroidParseXMLActivity", dptIDs[3]); //xmlOutput.setText(parsedData);}\[/code\]I want to use the values like name, mainNumber and so on outside my method. But I don't get it... I know this are java basic....Please help me, thanks!
 
Back
Top