I really dont know why is this android 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;