application is placed in the background, and the foreground application uses too many resources. By default, the mobile phone will recycle some resources of low-priority applications.
When our application returns to the front end, it may be It will cause an exception because the resource is recycled, causing the
fragment to display chaotically.
Checked the relevant information and other people's posts,
there is a simple solution,
rewrite it in the activity
@Override protected void onSaveInstanceState(Bundle outState) { // super.onSaveInstanceState(outState); }
comment out the method
super.onSaveInstanceState(outState);
ok.
The principle is roughly like this:
when the Activity resource is recycled, the method "onSaveInstanceState" will be called to save related objects and other resources
.
super.onSaveInstanceState(outState);Calling the method of the parent class,
when reloading the activity, the default is not to reload the embedded fragment.
This directly leads to the problem of confusion on the fragmnet page.
If we do not call the method of the parent class, it is equivalent to reloading the activity and its child fragments, avoiding
the .