Tôi có thể không loại bỏ AlertDialog của mình sau khi nhấp vào PositiveButton không?Android Đừng bỏ qua AlertDialog sau khi nhấp vào PositiveButton
Tôi muốn duy trì hộp thoại hiển thị nội dung cập nhật trên danh sách ArrayAdapter của tôiWords.
Đây là mã của tôi. Cảm ơn sự giúp đỡ :)
AlertDialog.Builder sayWindows = new AlertDialog.Builder(MapActivity.this);
final EditText saySomething = new EditText(MapActivity.this);
sayWindows.setPositiveButton("ok",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
say = userName + " Says: "+saySomething.getText();
showPosition.setText(say);
}
});
sayWindows.setNegativeButton("cancel",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
sayWindows.setAdapter(listWords, null);
sayWindows.setView(saySomething);
sayWindows.create().show();
bạn đã thử 'setCancelable (false) '? –
Tôi đặt sayWindows.setCancelable (false) bên dưới setTitle, nhưng nó không hoạt động. –
Và nó cũng không hoạt động trên PositiveButton onClick. –