Reputation: 15
In my application I have a requrement like, If I press backkey application should not exit(as i have only one activity in my app) instead it should minimize the app as like its happening with the home key press. Any help is appreciated..
Upvotes: 0
Views: 307
Reputation: 48272
You can probably just save whatever you need in Activity.onSaveInstanceState()
and restore the saved info in Activity.onRestoreInstanceState
as in this example Saving Android Activity state using Save Instance State
Upvotes: 1
Reputation: 2499
// Add this line inside back pressed.
@Override
public void onBackPressed()
{
moveTaskToBack(true);
}
Upvotes: 4