Java AlerDialog内的Alertdialog
我需要用自定义布局显示AlertDialog#1Java AlerDialog内的Alertdialog,java,android,android-alertdialog,Java,Android,Android Alertdialog,我需要用自定义布局显示AlertDialog#1R.layout。用按钮mybtn添加新条目,此按钮应打开另一个AlertDialog#2,带有单选列表,选择其中一个后,此对话框(AlertDialog#2)应将shoosen索引发送到第一个对话框(AlertDialog#1)并在AlerDialog#1的EditText字段中设置一些值。有可能吗 带有自定义布局的我的对话框#1: AlertDialog.Builder builder = new AlertDialog.Builder(get
R.layout。用按钮mybtn
添加新条目
,此按钮应打开另一个AlertDialog#2,带有单选列表,选择其中一个后,此对话框(AlertDialog#2)应将shoosen索引发送到第一个对话框(AlertDialog#1)并在AlerDialog#1的EditText字段中设置一些值。有可能吗
带有自定义布局的我的对话框#1:
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
LayoutInflater inflater = getActivity().getLayoutInflater();
builder.setView(inflater.inflate(R.layout.add_new_entry, null))
.setTitle(dialogTitle)
.setPositiveButton("Add", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
// My functions...
}
})
.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// My functions...
}
});
builder.create().show();
我花了一整晚的时间在它上面,我找不到任何好的例子或文章如何在对话中打开对话。
谢谢首先,您试过了吗?哪些有效/无效?第二,这对我来说似乎很“混乱”。您可以使用
对话框主题
将两者创建为活动
。这样做很简单。非常感谢。我将AlertDialog#1作为活动android:theme=“@android:style/theme.Dialog”
,将第二个对话框作为简单的对话框,这使所有的工作都对我有用。没问题。很高兴它对你有用