我正在尝试计算执行 AsyncTask 所用的时间,但 onPostExecute 方法没有登录任何内容,我做错了什么?
这是我的代码的一部分:
@Override
protected void onPreExecute()
{
this.dialog.setMessage(mensagem);
this.dialog.show();
Date date = new Date();
startTime = date.getTime();
}
@Override
protected void onPostExecute(String result)
{
if(this.dialog.isShowing() && this.dialog != null)
this.dialog.dismiss();
Date date = new Date();
endTime = date.getTime();
long diffTime = endTime - startTime;
//here nothing is logged in LogCat
Log.d("TEMPO DE REQUISIÇÃO", String.valueOf(diffTime) + " milisegundos");