title: How to set connection timeout for JSONParser.makeHttpRequest in Android?
body: <p>I am getting and posting some data with <code>JSONParser.makeHttpRequest</code>. When the connection is slow it takes a while to get a response and I would like to set the timeout limit to 5 seconds. I found <a href="https://stackoverflow.com/questions/693997/how-to-set-httpresponse-timeout-for-android-in-java">this post</a> showing how to set HttpResponse timeout but couldn't integrate it with JSONParser.</p>
  
  <p>Here is the code I use for HttpRequest</p>
  
  <pre><code>JSONParser jParser = new JSONParser();
  List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;();
  JSONObject json = jParser.makeHttpRequest(url, "GET", params);
  </code></pre>
  
  <p>I will be grateful if I can get a code snippet or a link to another post somewhere else. </p>