Note that there are some explanatory texts on larger screens.

plurals
  1. POandroid how to know HttpResponse takes how much time for giving response
    primarykey
    data
    text
    <p>I have an application where i want to find every time it connect with internet and fetching data from internet how much time it will take? and if takes more time then i want to give warning to user that "problem with Internet connection"</p> <p>So how I can know how much time it ll take., below a function of my application I gave, where <code>HttpResponse</code> i used.plz tell me how to get how much time it will take to give the response</p> <pre><code> String page = executeHttpGet("http://192.168.1.109/temp/android.php"); private String executeHttpGet(String URL) throws Exception { BufferedReader bufferedReader = null; try { HttpClient client = new DefaultHttpClient(); client.getParams().setParameter(CoreProtocolPNames.USER_AGENT, "android"); HttpGet request = new HttpGet(); request.setHeader("Content-Type", "text/plain; charset=utf-8"); request.setURI(new URI(URL)); HttpResponse response = client.execute(request); bufferedReader = new BufferedReader(new InputStreamReader(response .getEntity().getContent())); StringBuffer stringBuffer = new StringBuffer(""); String line = ""; String NL = System.getProperty("line.separator"); while ((line = bufferedReader.readLine()) != null) { stringBuffer.append(line + NL); System.out.print(stringBuffer); } bufferedReader.close(); page = stringBuffer.toString(); System.out.println(page + "page"); return page; } finally { if (bufferedReader != null) { try { bufferedReader.close(); } catch (IOException e) { Log.d("BBB", e.toString()); } } } } </code></pre> <p>Thank you.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload