Skip to content

Instantly share code, notes, and snippets.

@user-mw
Created December 7, 2019 15:26
Show Gist options
  • Select an option

  • Save user-mw/ebcf6636bfed2d2bc4bf07f7194c0631 to your computer and use it in GitHub Desktop.

Select an option

Save user-mw/ebcf6636bfed2d2bc4bf07f7194c0631 to your computer and use it in GitHub Desktop.
FragmentActivity getLastCustom...() and onRetainCustom...()
public class FragmentActivity {
// Code
public Object getLastCustomNonConfigurationInstance() {
NonConfigurationInstances nc = (NonConfigurationInstances)
           getLastNonConfigurationInstance();
return nc != null ? nc.custom : null;
}
public Object onRetainCustomNonConfigurationInstance() {
return null;
}
// Code
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment