0
People are giving this exception
because by what I researched, from Android 3.0 you can no longer make network call in an Activity, but I need this to be done:
Check out my Rssfeed reading class :
public class XmlReader {
private String rssUrl;
/**
* Constructor
*/
public XmlReader(String rssUrl) {
this.rssUrl = rssUrl;
}
/**
* Pega uma lista de XML.
*
* @return
*/
public List<Segmento> getItems() throws Exception {
// SAX parse RSS data
SAXParserFactory factory = SAXParserFactory.newInstance();
SAXParser saxParser = factory.newSAXParser();
XmlParseHandler handler = new XmlParseHandler();
saxParser.parse(rssUrl, handler);
return handler.getItems();
}
}
I’m calling her on View
thus:
RssReader reader = new RssReader("endereco.xml");
It needs to be done, but make the mistake
android.iosNetworkOnMainThreadException
. I saw that the solution was to use Asynctask, but I didn’t understand at least how to apply in my model, how would the implementation and the call?
See if this question/answer does not help solve the problem: http://answall.com/questions/33509/como-usar-a-biblioteca-ksoap2/33514#33514
– Wakim