case DIALOG_ID:
AlertDialog.Builder builder = new AlertDialog.Builder(this);
EditText edittext=(EditText)findViewById(R.id.name);
Appendable name=edittext.getText();
builder.setMessage(name + " Certificate saved successfully! Would like to add another Certificate?")
.setCancelable(false)
.setPositiveButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
SaveData.this.finish();
}
})
在builder.setMessage
我输入了一个名为 name 的字符串,当我在第一次进入对话框时在模拟器中输入名称但是当我在模拟器上将名称更改为其他名称时我首先输入的名称即将到来,它不会更改为第二个名称
我该怎么做?对我有什么帮助吗?
答案 0 :(得分:2)
获取String变量并存储edittext ::
中的文本EditText edittext=(EditText)findViewById(R.id.edittext_for_name);
String name=edittext.getText();
然后:
builder.setMessage(name+ " Certificate saved successfully. Would you like to add another certificate?")