我正在开发一个Android应用程序,它显示了一些基本的wifi信息,如信号强度和所有。预计还会显示网络往返延迟。我们可以通过使用HttpPost和HttpResponse来做到这一点。下面是我写的一段代码,但是我无法得到想要的结果
chronometer = (Chronometer) findViewById(R.id.chronometer);
chronometer.start();
chronometer.setBase(SystemClock.elapsedRealtime());
HttpPost url = new HttpPost("my url");
HttpClient roundclient = new DefaultHttpClient();
HttpResponse urlResponse = roundclient.execute(url);
HttpEntity roundentity = urlResponse.getEntity();
//InputStream inputStreamdelay = urlResponse.getEntity().getContent();
//if (null!= roundentity) {
//strTemp = br.readLine();
chronometer.stop();
System.out.println(SystemClock.elapsedRealtime());
Log.v("time", Double.toString(SystemClock.elapsedRealtime()));