I'm implementin开发者_如何学编程g an application witch need to run a task periodically, but its only needed if the application is in foreground. So i'd like to remove the periodic handler callbacks on application pause and resume on restart. There is any easy way of doing that? Thanks in advance
Call removeCallbacks() in onPause() and vice versa in onResume().
精彩评论