A non-ugly way to persist dialog contents across orientation changes?

Posted by alex on Stack Overflow See other posts from Stack Overflow or by alex
Published on 2010-06-07T20:27:36Z Indexed on 2010/06/07 20:32 UTC
Read the original article Hit count: 171

Filed under:

So I have a managed AlertDialog with a number of EditTexts & separate portrait + landscape layouts. The user opens the dialog in portrait mode, enters some text and then all of a sudden decides to pop out the keyboard. Now, I need to remove the dialog and recreate it for the changed layout persisting the text entered.
What I can think of is getting references to the EdiTexts in onPrepareDialog(..), then getting the actual text in onConfigurationChanged(..), then removing the dialog, then showing it again, then populating it. Rather ugly, huh?
Are there any better options?

© Stack Overflow or respective owner

Related posts about android