Unknown host exception json

Put your problem here if it does not fit any of the other categories.

Unknown host exception json

Postby vineet123 » Mon Sep 13, 2010 7:56 am

// I really dont knw why is this code not working . . , it shows unknown host exception


String requestTpServer = "www.google.com";
HttpClient client = new DefaultHttpClient();
HttpResponse response = null ;

try {

HttpGet get = new HttpGet(requestToServer);

get.setHeader("Accept", "application/json");
get.setHeader("content-type", "application/json");

response = client.execute(getm);
Log.i("Hit Success... in get deals response", "going to rendernow");

if (response != null ) {
Log.i("responsecode---", ""+response.getStatusLine().getStatusCode());
String jsonResponseFromServer = response.toString();
Log.i("json Response From Server", jsonResponseFromServer);
}
else {
Log.i("blank ", "reply ");
}
} catch (ClientProtocolException e) {

e.printStackTrace();
} catch (IOException e) {

e.printStackTrace();
}

String res = response.toString();
return res;
vineet123
Once Poster
Once Poster
 
Posts: 1
Joined: Mon Sep 13, 2010 7:34 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 16 guests