I want to make a progress bar while importing my articles from an XML feed.
The parsing works fine, but for my progress bar I need to quickly know the total # of <item>
s in the feed so I can determine percentage that have been loaded.
My thought was, it would be a lot faster to just do this in PHP and add the "count" to the feed itself - something like this:
<?xml version="1.0" encoding="utf-8"?>
<channel>
<title>My Apps Feed</title>
<link>http://link_to_this_fiel</link>
<language>en-us</language>
<count>42</count>
But then I need to be able to quickly access that "count" number.
At the moment, I have an RSSHandler.java
that's being called like this:
//Add all items from the parsed XML
for(NewsItem item : parser.getParsedItems())
{
//...
Note: Min API level 8 for my app