I have a dialog, which is created from a fragment in my application. When I rotate the device, the dialog should reappear in the state it was in before. I have tried setRetainInstance(true) but it doesn’t work.
I figured that by saving the dialog’s instancestate and adding it into the bundle for onSaveInstanceState() in the fragment, and restoring the instancestate in onActivityCreated() will allow me to restore the dialog. However, I’m getting a null pointer exception when I am trying to restore..
Please help, thanks.
Ended up using a
DialogFragmentto make it work properly in the end.