java - DialogFragment: how to prevent saving state? -
i have several classes extending dialogfragment show popups. model class that's used show popup data comes library can't change.
public class myfragment extends dialogfragment { private list<mymodel> modeldata; ... }
now, dialogfragment shown, if hit home button, crash
06-09 17:21:04.265: e/androidruntime(31470): java.lang.runtimeexception: parcel: unable marshal value .....
the obvious fix change mymodel class implement parcelable. tried similar case , works unfortunately of model classes used in dialogfragments in library , cannot change make them parcelable , don't want wrapper classes.
i don't support orientation change , don't have usecase contents of dialog need preserved. there way can ignore state saving process crash can prevented?
i figured out , wanted post solution in case else runs same situation. had override onpause this
@override public void onpause() { super.onpause(); dismissallowingstateloss(); }
Comments
Post a Comment