How to set connection timeout for JSONParser.makeHttpRequest in Android?
问题 I am getting and posting some data with JSONParser.makeHttpRequest . 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 this post showing how to set HttpResponse timeout but couldn't integrate it with JSONParser. Here is the code I use for HttpRequest JSONParser jParser = new JSONParser(); List<NameValuePair> params = new ArrayList<NameValuePair>(); JSONObject json = jParser.makeHttpRequest(url, "GET", params); I will