I need help with Android. Here is problem I need to catch event when application went to background. (ex. home is pressed or any other action that push my app in backgound) Currently I'm able to catch onPause for activity
@Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
}
Is there any override for some event on application level ?
From your comment it sounds like you want to know when your program returns from the background, instead of when it goes to the background.
You can use onResume
for that. also, see the Activity Lifecycle. You can see the remark "activity comes to the foreground", which is what I gather from your comment the thing you want.
Note: your activity will call onResume
the first time the activity is started, so you might want to set a boolean in onPause to signal your app that it actually went to the background.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With