用戶保存其細節時有第一個活動。點擊保存按鈕後,Alertdialog詢問關於確定或取消。如果用戶點擊確定,則新的活動開始。如何通過選擇確定按鈕在警報對話框中啓動一個新的活動類
protected final Dialog onCreateDialog(final int id) {
Dialog dialog = null;
switch(id) {
case DIALOG_ID:
AlertDialog.Builder builder = new AlertDialog.Builder(AppointInformation.this);
builder.setMessage("Information saved successfully ! Add Another Info?")
.setCancelable(false)
.setPositiveButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
startActivity(new Intent(((Dialog)dialog).getContext(),CheckPatient.class));
}
})
.setNegativeButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alert = builder.create();
dialog = alert;
break;
default:
}
return dialog;
}
從AlertDialog界面中創建意圖時,不能簡單地使用「this」。 – VarnerBeast14 2014-08-12 05:23:16