爲什麼不工作setText(「」)? EditText存儲最後的輸入數據,當我再次調用AlertDialog時,顯示存儲的數據。setText(「」)不起作用
case IDD_SET_NAME:
builder=new AlertDialog.Builder(this);
builder.setTitle("Name Title");
EditText input = new EditText(this);
input.setText("");//This method not work
builder.setView(input);
builder.setPositiveButton("Create", onClickListener_DialogResetPin);
builder.setNeutralButton("Cancel", onClickListener_DialogResetPin);
// create and show dialog
dialog = builder.create();
dialog.show();
Button btnOK = dialog.getButton(AlertDialog.BUTTON_POSITIVE);
btnOK.setOnClickListener(onClickListener_btnOK);
break;
爲什麼你用空字符串設置文本? –
而不是空的EditText你得到什麼? –
嘗試使用--' input.setText(「Testing」)設置一些字符串;' – Praveenkumar