Linked Questions

79 votes
3 answers
111k views

I created android application and use JSON get data from server but I got the error show below: android.os.NetworkOnMainThreadException at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(...
user3415458's user avatar
26 votes
5 answers
113k views

Here i am using this code load Json. It is work fine with android 2.2 but when i am using android 4.2 it throws android.os.NetworkOnMainThreadException exception please give me solution public ...
Lazy Lion's user avatar
  • 861
20 votes
3 answers
44k views

I'm creating an project for assignment, I'm new to Android, and I wanted to access json from very common url http://api.androidhive.info/contacts/, Problem: I'm trying to read the url and fetch and ...
10 votes
2 answers
54k views

String response = getResultForRequest(url); Where 'url' is JSON formatted which return bunch of data using http GET method. public static String getResultForRequest(String urlString) throws ...
Dhruv's user avatar
  • 1,882
32 votes
5 answers
25k views

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 ...
16 votes
1 answer
33k views

Here is my code to connect HTTP. URL url = new URL("http://www.google.com"); HttpURLConnection con = (HttpURLConnection) url.openConnection(); con.setDoOutput(true); ...
ray's user avatar
  • 4,270
3 votes
7 answers
14k views

I want to add images from certain URLS dynamically to a linear layout.While running the piece of code i got error Unable to start activity ComponentInfo: android.os.NetworkOnMainThreadException at ...
Ashish's user avatar
  • 188
3 votes
2 answers
25k views

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 and ...
0 votes
3 answers
13k views

Hi I'm trying to send data to a webservice String url = "https://www.myurl.com"; URL urlobj = new URL(url); HttpsURLConnection con = (HttpsURLConnection) urlobj.openConnection(); con....
10 votes
2 answers
8k views

I've been trying to get this to work for the last week or so and still have no idea what the problem is. it works on android 2.1 but not on 4.1. ive got this string in a service that check for updates ...
6 votes
2 answers
20k views

I am creating a client socket connection between my computer and android. Here is the code for the server: import java.io.PrintWriter; import java.net.InetAddress; import java.net.ServerSocket; ...
5 votes
2 answers
5k views

Hi, I try to check network connectivity and Internet present by using following method check = new ConnectionDetector(getApplicationContext()); conn = check.isConnectingToInternet(); public ...
24 votes
0 answers
67k views

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, ...
0 votes
5 answers
8k views

I want to check the HTTP response of a certain URL before loading into a webview. I only want to load webview if http response code is 200. This is a workaround for intercepting http errors. I have ...
1 vote
2 answers
10k views

I am using 4.0.3 target and I am using ksoap2. The webservice is WCF of Visual Studio 2010 Express. It Could be an error of soap_action, call or namespace. I am getting next error each time 05-24 ...
Dave's user avatar
  • 7,449

15 30 50 per page
1
2 3 4 5
...
74