开发者

Handle Timer when incoming calls & SMS

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜