java - Android AsycTask ellapsed time calculation -


i'm trying calculate time ellapsed in execution of asynctask, nothing logged in onpostexecute method, i'm doing wrong?

here part of code:

@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 logged in logcat         log.d("tempo de requisiÇÃo", string.valueof(difftime) + " milisegundos"); 

  1. check logcat level, @ debug.
  2. make sure not cancelling asynctask while running otherwise onpostexecute won't run.
  3. also if being run in service there maybe issues looper not being set if asynctask not running.
  4. try changing "tempo de requisiÇÃo" "tempo de requisicao" might logcat not support character encoding.

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -

php - Accessing static methods using newly created $obj or using class Name -