• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Saving data from Plist.xml always results in app crashing.


Sep 14, 2013
Hi guys, I have a plist xml file located under URL/?format=plist

and now want to read it out and save it into strings. but when i start the application on my phone it always crashes without doing anything. what exactly am i doing wrong? i saw several tutorials on plist but those tutorials only covered "normal" plist files. this has an array inside the arrays so i thought i would go with a while loop in a while loop, but without success. any suggestions?

here is the function. it gets called in the onCreate method.

[HIGH]private void _parseXML() throws IOException, XmlParseException
StringBuffer fileData = new StringBuffer(1024);
URL sourceURL = new URL(URL/?format=plist);
BufferedReader in = new BufferedReader(new InputStreamReader(sourceURL.openStream()));
String inputLine;
while ((inputLine = in.readLine()) != null){
HashMap<?, ?> hashMap = (HashMap<?, ?>)Plist.objectFromXml(fileData.toString());
ArrayList<?> items = (ArrayList<?>) hashMap.get("Items");
Object itemsObj[];
itemsObj = items.toArray();
for(int i = 0; i < itemsObj.length; i ++){
HashMap<?, ?> subHashMap = (HashMap<?, ?>) itemsObj;
String source = (String) subHashMap.get("Source");
String date = (String) subHashMap.get("Date");
HashMap<?, ?> scoresHashMap = (HashMap<?, ?>)Plist.objectFromXml(fileData.toString());
ArrayList<?> scores = (ArrayList<?>) scoresHashMap.get("Scores");
Object scoresObj[];
scoresObj = scores.toArray();
for(int j = 0 ; j < scoresObj.length; j ++)
HashMap<?, ?> scoreNameHashMap = (HashMap<?,?>) scoresObj;
String scoreName = (String) scoresHashMap.get("ScoreName");
String ScoreIcon = (String) scoresHashMap.get("ScoreIcon");
String ScoreValue = (String) scoresHashMap.get("ScoreValue");
String headline = (String) subHashMap.get("Headline");
String excerpt = (String) subHashMap.get("Excerpt");
String imageUrl = (String) subHashMap.get("ImageURL");
String articleUrl = (String) subHashMap.get("ArticleURL");
String sourceUrl = (String) subHashMap.get("SourceURL");
String sourceFav = (String) subHashMap.get("SourceFavicon");



We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.