0

I would like to know if dialogs go to stack, as Activities go.. Because I have now a dialog "A", and I can click on a button that opens a new dialog "B".. But if I close the dialog "B", there is no longer the dialog "A". And I dont want to create a new Dialog "A" I want to continue as the way I leave it..

The close button of "B" does nothing.. it has a null onClickListener:

new AlertDialog.Builder(activity).setNegativeButton("Exit", null).show(); 

Can someone help me? Thanks in advance ;)

TiagoM
  • 3,458
  • 4
  • 42
  • 83
  • Found the answer here: http://stackoverflow.com/questions/6142308/android-dialog-keep-dialog-open-when-button-is-pressed Thanks ;) – TiagoM Apr 21 '13 at 14:05
  • 1
    I think you should not show a `Dialog` on top of each other. Dialogs in Android are intended to be shown one at time. – a.bertucci Apr 21 '13 at 14:53

1 Answers1

1

In Android you simply can't stack Dialog instances. You could achieve the same result managing the workflow yourself (A -> B -> A) but you have to save/restore A status yourself somehow.

So you could choice between:

  1. switch to DialogFragment and use the fragment backstack and their instance management
  2. subclass A and B from Activity and apply the Theme.Dialog to them
a.bertucci
  • 12,142
  • 2
  • 31
  • 32