How to synchronize the time interval with button event in android?
I want my app to check running tasks after every 10 secs of some specific button event.
I used Timer
to do this work for me but Timer
is synchronized with system clock not with my button event and i want this time interval to be synchronized with my button event. for ex its been 3 seconds since my app is started and i am clicking on my button after 3 seconds so all tasks should be loaded after 10 secs of these total(3+3) 6 seconds but its loading 开发者_StackOverflowthe tasks after(10-3-3) 4 seconds.
Is there any way to synchronize this time interval with my button event?
Sorry if i am unable to make you understand my question. If anyone understand what i just said please feel free to edit my question so everyone can understand it easily.
Thanks.
I had a similar problem in that I wanted the timer to fire every minute, (though I wanted to sync with the clock). Nonetheless, like in my problem, I think the schedule method of the Timer class might help you.
Here is the link to that post.
Best way to update TextView, every minute, on the minute
Hope it helps, Mel
精彩评论