How to save Object while orientation change, since onRetainNonConfigurationInstance and getLastNonConfigurationInstance are deprecated. And which cannot me used with compa
When your Fragment is paused it will call this method:
@Override
public void onSaveInstanceState(Bundle outState) {
// Add variable to outState here
super.onSaveInstanceState(outState);
}
The variable outState
will then be fed into the onCreate() method when the Fragment restarts.
You can save any data that is a basic type or implements Parcelable
interface