Timer In Three Edittexts Not Working Properly
I have made a Timer Application in android.In application there are three (uneditable)EditText and a Button.When i press Button first time the timer in 1st EditText will start ,whe
Solution 1:
Look at this code in your lap2 handler:
timer.schedule(new thirdTask(), 0,500);
h2.removeCallbacks(run);
timer.cancel();
timer.purge();
b.setText("Stop");
You schedule a task and cancel the timer immediately afterwards.
I would suggest that you get rid of the Timer
and just use the Handler.postDelayed()
method, as you have done already for the time updates and to start the update of the first field:
h2.postDelayed(run, 0);
Use the same method to start the updates for second and third fields. You don't need the Timer
and TimerTask
instances at all.
Also, why do you need two handlers (handler
, and h2
)?
Post a Comment for "Timer In Three Edittexts Not Working Properly"