Android.os.NetworkOnMainThreadException issue

You can get this error when the application tries to perform a networking operation with its main thread.

To resolve it, you have to run your code in AsyncTask :

class RetrieveFeedTask extends AsyncTask {

    private Exception exception;

    protected RSSFeed doInBackground(String... urls) {
        try {
        } catch (Exception e) {
            this.exception = e;

            return null;

    protected void onPostExecute(RSSFeed feed) {
        // TODO: check this.exception
        // TODO: do something with the feed