开发者

Start Activity on AlertDialog

I am using an alertdialog t开发者_C百科o add a new contact and inside is a button which is supposed to let the user choose a picture source, either from taking a picture or selecting one from the gallery. If I use startActivity from inside the alertdialog, would I be able to return to the alertdialog without the alertdialog closing? I tried adding another dialog to the dialog in other fields for input validation but the alertdialog seems to close before the other popup shows up.


You should use Activity in Dialog Mode for this. AlertDialog is not supposed to do what you are doing and yes it will close and lose its context.

Here is how to do it.

<activity android:name=".MyDialogActivity" 
        android:theme="@android:style/Theme.Dialog" 
        android:configChanges="keyboardHidden|orientation|keyboard"></activity>


You can simply have your dialog extend Activity instead of Dialog. Then apply the dialog theme to that activity. See Android Activity as a dialog

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜