title: How to calculate the execution time of HTTP request
body: <p>I have a function like this, result contains a JSON object.</p>
  
  <pre><code>public void rebuildhar() {
  
    StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
    StrictMode.setThreadPolicy(policy);
  
    List &lt; MyResponse &gt; list_response = new ArrayList &lt; MyResponse &gt; ();
    String[] parts = result.toString().split(",");
  
    List &lt; String &gt; list_parts = new ArrayList &lt; String &gt; ();
    String splitter = "\"url\":\"";
  
    for (int i = 0; i &lt; parts.length; i++) {
     if (parts[i].startsWith(splitter)) {
      String clear_partial_string = parts[i].replace("\"url\":\"", "").replace("\"", "");
      list_parts.add(clear_partial_string);
  
      String address = clear_partial_string.replace("\\", "");
  
      try {
       url = new URL(address);
      } catch (MalformedURLException e) {
       Log.i(WEBPM_AGENT, e.toString());
      }
  
      if (url != null) {
       if (url.toString().contains("https")) {
        /*
        try {
        urlConnection = (HttpURLConnection) url.openConnection();
        } catch (IOException e) {
        e.printStackTrace();
        }
        urlConnection.setDoInput(true);
        urlConnection.setDoOutput(true);
        */
        wv = new WebView(AgentActivity.this);
  
        wv.getSettings().setLoadWithOverviewMode(true);
        wv.getSettings().setUseWideViewPort(true);
        wv.setInitialScale(1);
        wv.getSettings().setJavaScriptEnabled(true);
  
        wv.loadUrl(url.toString());
        wv.setWebViewClient(new WebViewClient() {
  
  
         @Override
         public void onPageStarted(WebView view, String url, Bitmap favicon) {
          tStart = System.currentTimeMillis();
         }
  
         @Override
         public void onPageFinished(WebView view, String url) {
          tEnd = System.currentTimeMillis();
  
          tDelta = (tEnd - tStart);
  
          System.out.println("DEBUG:" + "URL: " + url + "\n Time: " + tDelta/* +"\n Size: " +urlConnection.getContentLength()*/);
  
          tStart = 0;
          tEnd = 0;
          tDelta = 0;
         }
        });
        // list_response.add(new MyResponse(address,elapsedSeconds,urlConnection.getContentLength()));
       }
      }
     }
    }
   }
  </code></pre>
  
  <p>What that I wat obtain is:</p>
  
  <ul>
  <li><p>For each URL(HTTPS) in a JSON array I want test the execution time of the request.</p>
  
  <ul>
  <li>Save this data in an arrayList</li>
  </ul></li>
  </ul>
  
  <p>The problem is that tstart is always 0 after it's first run</p>
  
  <p>But this solution doesn't work...</p>