how to set code while minimizing the application like "onBackPressed" in android. my countdown timer is running while application is minimized, so i want to put a intent to main page while minimized.
Asked
Active
Viewed 73 times
1 Answers
0
I'm not sure if I understood you completly but if you want to do some action when your app is sent to the background, your buddy will be the onPause()
method. There you can stop your handler or whatever you use to run your countdown and resume it in the onResume()
method which will be called when the app is coming to foreground.
For further information on this have a look in the official docs. The Activity Lifecycle is well described there with an additional image.
If you could provide some code of your countdown we can maybe give you some help on how to pause and resume it. I'm not sure why you would use an Intent there?

Phil
- 646
- 1
- 8
- 23