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 ;)

4

1 回答 1

1

在 Android 中,您根本无法堆叠Dialog实例。您可以自己管理工作流程(A -> B -> A)获得相同的结果,但您必须以某种方式自己保存/恢复 A 状态。

所以你可以选择:

  1. 切换到DialogFragment并使用片段 backstack 及其实例管理
  2. 子类 A 和 BActivity并应用于Theme.Dialog它们
于 2013-04-21T14:31:50.040 回答