Reputation: 2604
Upvotes: 0
Views: 2187
Reputation: 16110
The activity is not destroying the content on pause. it does do that on onDestroy. You are probably rotating the screen which causes the bottom activity to re-create. you need to save state if you want to preserve the content.
Upvotes: 1
Reputation: 8747
No. That is the lifecycle of an Activity. As soon as the view is obstructed then the Activity will pause, once it is completely hidden it will stop, at which point Android can destroy it at any time to reallocate resources for other Activities.
This helped me understand more.
Upvotes: 2
Reputation: 44571
You can't keep the Activity
from pausing because it needs to follow the Activity Lifecycle but you can override onPause()
and save whatever you need
@Override
public void onPause()
{
// save your data
}
How you save the content depends on what you need. But if you are going to an activity and coming right back then you would want to use startActivityForResult()
to accomplish this
Upvotes: 2