views:

400

answers:

2

Hi,

I wonder what is the right way to implement this? Could anybody advice whether my solution is correct?

So:

  1. Activity is created
  2. User clicks on button and dialog is launched (Dialog, not dialog styled activity)
  3. User opens keyboard
  4. we have onSaveInstanceState called where we save that our dialog was opened and all respective dialog input
  5. we have onRestoreInstanceState and here we check whether dialog was shown, recreate the dialog with respective input.

Is it the right approach? or there is smth. that is done by Android and I am doing some redundant actions.

Thanks

+1  A: 

Try commenting out your onRestoreInstanceState() and see if the application still loads the information that you expected to be saved.

I hope that helps! Cheers.

Unfortunately, it will not. Actually, my question was about the right way to do that. Currently I do save all required information, but I wonder what is the right way to do that from design point?
Lyubomyr Dutko
+2  A: 

Yes, that is the right way to do it. Dialogs don't extend Activitys, but they work very similarly and you've just described exactly the correct "flow" for saving/restoring states for either.

fiXedd