开发者

Android timer problem

开发者 https://www.devze.com 2023-04-06 00:58 出处:网络
I am using timer in my application for the background process and开发者_开发问答 the timer runs successfully.

I am using timer in my application for the background process and开发者_开发问答 the timer runs successfully. But the problem is that i have to stop timer when logout button is clicked , the logout button is in different Activity. i have used timer.cancel() but As the Both Activity different it does't work. so give some hint to stop timer.


Declare your Timer as public static Timer timer; and you will be able to access it in any Activity or class using Acitivity_name.timer.cancel();

Thanks...

0

精彩评论

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

关注公众号