gpt4 book ai didi

java - 更改对话框文本 Android

转载 作者:行者123 更新时间:2023-11-30 10:44:52 25 4
gpt4 key购买 nike

我有这段代码:

private void displayMessage(String message)
{


LayoutInflater factory = LayoutInflater.from(this);
final View deleteDialogView = factory.inflate(R.layout.dialog_confirmation, null);
final AlertDialog deleteDialog = new AlertDialog.Builder(this).create();
deleteDialog.setView(deleteDialogView);
deleteDialogView.findViewById(R.id.dialog_btn_yes).setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {
//your business logic
deleteDialog.dismiss();
finish();
}
});
deleteDialogView.findViewById(R.id.dialog_btn_no).setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {
deleteDialog.dismiss();

}
});

deleteDialog.show();
}

我想要做的是获取消息参数,并将此消息放入对话框的 XML 布局中的 TextBox 中。我试过这个:

   TextView confirmationTextView = (TextView) findViewById(R.id.order_summary_text_view);
confirmationTextView.setText(message);

但它不起作用。有任何想法吗?谢谢!

最佳答案

替换这个

TextView confirmationTextView = (TextView) findViewById(R.id.order_summary_text_view);

TextView confirmationTextView = (TextView) deleteDialogView .findViewById(R.id.order_summary_text_view);

关于java - 更改对话框文本 Android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37260520/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com