All Questions

1818
votes
48answers
931304 views

How do I fix android.os.NetworkOnMainThreadException?

I got an error while running my Android project for RssReader. Code: URL url = new URL(urlToRssFeed); SAXParserFactory factory = SAXParserFactory.newInstance(); SAXParser parser = factory.newSAXPar...
23
votes
5answers
22533 views

NetworkOnMainThreadException

I just found out about NetworkOnMainThreadException at official docs and was wondering if the emulator is throwing this. I have been testing my app quite a bit and as far as I know all networking is ...
44
votes
9answers
157119 views

Android - android.os.NetworkOnMainThreadException

I have this exception and I was reading a thread on this, and it seemed confusing: How to fix android.os.NetworkOnMainThreadException? I already added this line to my manifest: <uses-permission ...
16
votes
1answers
53391 views

Caused by: android.os.NetworkOnMainThreadException

Hi all Viewers and readers, I am using link. Whenever I run this code in separate package it works fine, but whenever I am trying to embed this sample in my app, getting Unfortunately app has stopped,...
19
votes
3answers
20123 views

OkHttp Library - NetworkOnMainThreadException on simple post

I want to use OkHttp library for networking in Android. I started with the simple post example as written in their website: public static final MediaType JSON = MediaType.parse("application/json; cha...
3
votes
4answers
7289 views

Android HttpClient : NetworkOnMainThreadException

I have some code below: protected void testConnection(String url) { DefaultHttpClient httpclient = new DefaultHttpClient(); HttpGet httpget = new HttpGet(url); ResponseHandler<String&g...
8
votes
3answers
19334 views

Quick fix for NetworkOnMainThreadException

I need to execute third-party open source program, which throws NetworkOnMainThreadException. According to SDK reference, this is only thrown for applications targeting the Honeycomb SDK or higher. Ap...
0
votes
2answers
17488 views

android.os.NetworkOnMainThreadException sending an email from Android

I have written an application which sends email from an Android device but I get the following exception when I try to send an email: android.os.NetworkOnMainThreadException Why is this occurring an...
6
votes
2answers
3812 views

android.os.NetworkOnMainThreadException in AsyncTask's doInBackground

Why do I get in an AsyncTask which should a android.os.NetworkOnMainThreadException? I thought that an AsyncTask is the solution to that problem. The exxeption is on line 7. private class ImageDownlo...
2
votes
4answers
8658 views

android.os.NetworkOnMainThreadException

In my application am getting android.os.NetworkOnMainThreadException. I am trying to get images from url at that time i am getting this Exception. If i run application in 2.2 it is working fine but if...

Previous Next