set timeout in httprequest android
问题 I am using the following code to get data from the server with http request. HttpClient client = new DefaultHttpClient(); String URL = urlGenerator(); StringBuilder url = new StringBuilder(URL); HttpGet get = new HttpGet(url.toString()); HttpResponse response = client.execute(get); int status = response.getStatusLine().getStatusCode(); if(status == 200){ ... } Its working fine.But in case if the phone is connected to wifi or gprs 3g but internet is not working or internet connection is not