title: Android -Json httpRequest Time out Connection
body: <p>How to make a Connection Timeout, when I do a httpRequest? I return to the previous activity? For my apilcacion is blocked by a firewall, and I can make some time to not be able to connect to the server, I return to the previous activity and display a Toast telling me no internet connection?</p>
  
  <p>This is part of my code:</p>
  
  <pre><code>protected String doInBackground(String... args) {
  
          List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;();
  
          JSONObject json = jParser.makeHttpRequest(url_list, "GET",
                  params);
  
          Log.d("All Products: ", json.toString());
  
          try {
  
              int success = json.getInt(TAG_SUCCESS);
  
              if (success == 1) {
  
                  daftar_rs = json.getJSONArray(TAG_DAFTAR_RS);
  
                  for (int i = 0; i &lt; daftar_rs.length(); i++) {
                      JSONObject c = daftar_rs.getJSONObject(i); 
  //Continue here with a process to show a listview...
  </code></pre>
  
  <p>When there is no internet connection the application closes completely showing an error, anyone know how I can fix it? Thank you very much! Greetings teachers!</p>