These days have been learning to develop RSS reader, encountered a very pit problem, InputSource here is always wrong. For a long time, finally let me find a solution----look at the code:
New Thread () {
@Override
public void Run () {
try {
URL url = new URL (rss_url);
SAXParserFactory factory = Saxparserfactory.newinstance ();
SAXParser parser = Factory.newsaxparser ();
XMLReader XMLReader = Parser.getxmlreader ();
RssHandler RssHandler = new RssHandler ();
Xmlreader.setcontenthandler (RssHandler);
LOG.E ("Cuola1", XmlReader + "");
InputSource is = new InputSource (Url.openstream ());
LOG.E ("Cuola55", is + "");
Xmlreader.parse (IS);
Rssfeed=rsshandler.getfeed ();
LOG.E ("Ffdf", Rssfeed.getitem (0). GetTitle () + "");
Showlistview ();
LOG.E ("Ngjdgd", "Yunx");
New Handler (). Post (new Runnable () {
@Override
public void Run () {
}
});
} catch (Exception e) {
} finally {
}
Super.run ();
}
}.start ();
Parse the XML in the new thread.
Android RSS reader Development A little bit of tricks