I have created the following function for checking the connection status:
private void checkConnectionStatus() { HttpClient httpClient = new DefaultHttpC
If you are using the HttpURLConnection, call setConnectTimeout() as described here:
HttpURLConnection
setConnectTimeout()
URL url = new URL(myurl); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setConnectTimeout(CONNECT_TIMEOUT);