I have started multiple Timers on the same screen.
W开发者_运维百科hen an incoming call or SMS comes, how can I handle the functioning of the timers. The timer should continue running when the incoming call is being attended by the user.
Kindly provide your inputs/sample code.
The problem with Timers is that they depend on the current Activity state, so if the activity has been completely obscured (like when a call arrives) it's onStop() method will be called, and Android doesn't guarantee that your app will continue running from that point.
The best solution to this is to use services. Here you have official Services guide.
精彩评论