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

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

python - Django-cities exits with "killed" -

python - How to get a widget position inside it's layout in Kivy? -