简体   繁体   English

如何从AlertDialog返回到AlertDialog之前

[英]How to return from an AlertDialog to the AlertDialog before

How can I return from an AlertDialog which is called and offers more buttons and the user clicks on one of this buttons, then a new AlertDialog pops up with an input field. 我该如何从一个AlertDialog返回,该AlertDialog提供了更多按钮,并且用户单击了其中一个按钮,然后弹出了一个带有输入字段的新AlertDialog So if I check if the user input is eg numeric, how can I return to the AlertDialog offered before? 因此,如果我检查用户输入是否为数字输入,如何返回之前提供的AlertDialog

I'd suggest using a DialogFragment from the support library for each of these Dialogs. 我建议为每个对话框使用支持库中的DialogFragment Just add onClickListeners to each of the buttons of the first DialogFragment and show the second DialogFragment in onClick . 只需将DialogFragment添加到第一个DialogFragment每个按钮上,并在onClick显示第二个DialogFragment

There should not be any necessity for checking if the input is a number if you just set the appropriate input type first. 如果您只是先设置适当的输入类型,则没有必要检查输入是否为数字。

When the user taps a button on the second DialogFragment , just call dismiss() . 当用户点击第二个DialogFragment上的按钮时,只需调用dismiss()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM