I used timer.schedule(timerTask,0,1000); then use timer.cancel() to stop the job. It works fine. But after I call timer.schedule(timerTask, 0,1000) again to start the same task, android crashed.
Following is my timerTask code. So I guess Timer is not work in android: class updateTime extends TimerTask { public void run() { audioTime.post(new Runnable() { public void run() { recordTime++; int hour=(int)recordTime/3600; int min=(recordTime-hour*3600)/60; int sec=recordTime-hour*3600-min*60; String hStr, mStr, sStr; if(hour<10) hStr="0"+hour; else hStr=""+hour; if(min<10) mStr="0"+min; else mStr=""+min; if(sec<10) sStr="0"+sec; else sStr=""+sec; String timeStr=hStr+":"+mStr+":"+sStr; audioTime.setText(timeStr); } }); } } --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---