i have an android app with several activities. I need to start a timer when the first activity starts and end the timer when the last activity starts and show the elapsed time. How can i use Asynctask to do this.
A:
Make it static. Why you use timer to count time? Will be better to use currentTimeMillis ().
Orsol
2010-06-28 10:44:12
A:
Subclass Application, declare a public static long started; which will be assigned to System.currentTimeMillis(); by the first Activity in onCreate() or onResume(). Have the last Activity read the value and calculate delta.
If you absolutely want to use AsyncTask (which I think is irrelevant in this case), you'll at least need a mediatory Service for that.
alex
2010-06-28 11:03:44
oooooooooooo, Thanks a lot
2010-06-30 10:34:05
I did it, thak you soo much
2010-06-30 11:39:45