android - Timer in Asynchronous Task does not work as expected -



android - Timer in Asynchronous Task does not work as expected -

i execute 1 task within asynchronous task , set time limit 15 seconds, hits 3, 5 , 10 seconds. don't know whats going wrong. if can help i'd appreciate it, thanks!

public void callasynchronoustask() { final handler handler = new handler(); timer timer = new timer(); timertask doasynchronoustask = new timertask() { @override public void run() { handler.post(new runnable() { public void run() { seek { // task } grab (exception e) { } } }); } }; timer.schedule(doasynchronoustask, 15000, 15000); }

i have done timer calculate proper time , if want stop mytimer.cancel(). , @pearsonartphoto referring :)

timer mytimer; mytimer = new timer(); mytimer.schedule(new timertask() { @override public void run() { // task } }, 0, 10000);

android asynchronous

Comments

Popular posts from this blog

php - Edges appear in image after resizing -

ios8 - iOS custom keyboard - preserve state between appearances -

Delphi change the assembly code of a running process -