Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 截击反应时间_Java_Android_Android Volley - Fatal编程技术网

Java 截击反应时间

Java 截击反应时间,java,android,android-volley,Java,Android,Android Volley,我有一些关于截击的问题 如何通过截击库获取连接响应时间 有解决办法吗 我可以使用定时器获取响应时间吗?如何 还有一个在截击中连接前执行的方法吗 我的代码如下: final String URL = "http://domain.com/conn.php"; StringRequest req = new StringRequest(URL, new Response.Listener<String>() { @Override public void onResp

我有一些关于截击的问题

  • 如何通过截击库获取连接响应时间
  • 有解决办法吗
  • 我可以使用定时器获取响应时间吗?如何
  • 还有一个在截击中连接前执行的方法吗
我的代码如下:

final String URL = "http://domain.com/conn.php";
StringRequest req = new StringRequest(URL, new Response.Listener<String>() {
    @Override
    public void onResponse(String response) 
    {
        startActivity(new intent(SplashActivity.this,MainActivity.class));
        finish();
    }
}, 
new Response.ErrorListener() 
{
    @Override
    public void onErrorResponse(VolleyError error) 
    {
        if(RRequestErrorHelper.getMessage(error) == null || RRequestErrorHelper.getMessage(error).isEmpty())
        {
        }
        zLog.error(RRequestErrorHelper.getMessage(error));
    }
});

zRequestHelper.getInstance().addToRequestQueue(req,"TAG");
最终字符串URL=”http://domain.com/conn.php";
StringRequest req=newStringRequest(URL,new Response.Listener()){
@凌驾
公共void onResponse(字符串响应)
{
startActivity(新意图(SplashActivity.this,MainActivity.class));
完成();
}
}, 
新的Response.ErrorListener()
{
@凌驾
公共无效onErrorResponse(截击错误)
{
if(RRequestErrorHelper.getMessage(错误)=null | | RRequestErrorHelper.getMessage(错误).isEmpty())
{
}
error(rrequesterrorheloper.getMessage(error));
}
});
zRequestHelper.getInstance().addToRequestQueue(请求,“标记”);

我想这会很好。实际上我没有试过,但他们提供了日志输出。我看到谷歌截击的i/O会话,他刚刚提到了。下面是该课程的屏幕截图


在那个会话中,他提到它将生成详细的日志条目,并且从将请求添加到队列中到发布响应,每个操作都有时间。

您需要
VolleyLog

添加
VolleyLog.DEBUG=true在代码中

从亚洲开发银行,尝试以下方法:

  • 如果您有许多设备-
    adb-s[deviceId]shell setprop
    log.tag.Volley VERBOSE

  • 如果您有1台设备-
    adb[deviceId]shell setprop log.tag.Volley
    冗长的

  • 如果您在emulator中进行了测试-
    adb emulator-5555 shell setprop
    log.tag.Volley VERBOSE