public class NewsItemFactory { /* Data Model Class */ public static class NewsItem { public String title; public String link; public String description; @Override public String toString() { return title; } } /* * Parse the RSS feed out into a list of NewsItem elements */ public static List<NewsItem> parseFeed(XmlPullParser parser) throws XmlPullParserException, IOException { List<NewsItem> items = new ArrayList<NewsItem>(); while (parser.next() != XmlPullParser.END_TAG) { if (parser.getEventType() != XmlPullParser.START_TAG){ continue; } if (parser.getName().equals("rss") || ...
Get Android Recipes: A Problem-Solution Approach for Android 5.0, Fourth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.