This exception is thrown when an application attempts to perform a networking operation on its main thread. If your task took above five seconds, it takes a force close.
Run your code in AsyncTask
:
class RetrieveFeedTask extends AsyncTask<String, Void, Boolean> {
protected RSSFeed doInBackground(String... urls) {
// TODO: Connect
}
protected void onPostExecute(RSSFeed feed) {
// TODO: Check this.exception
// TODO: Do something with the feed
}
}