android - How to keep dialog showing on orientation change? -
this question has answer here:
i have activity inflates listview. on list item click dialog opened(it handled in corresponding list adapter.) on orientation change showing dialog (if any) disappeared (as expected.) want showing dialog not dismiss on orientation change , don't have idea how cleanly handle it.
when rotate phone, activity destroyed , recreated. includes dialog. yes, quite possibly stupidest design decision in history, we're stuck it. there 2 ways fix it:
1) turn off "helpful" functionality. if don't have different layouts landscape , portrait i'd suggest. add android:configchange="orientation|resize" activity in manifest.
2) implement onsaveinstancestate/onrestoreinstancestate , have variable says whether or not need recreate , relaunch dialog.
Comments
Post a Comment