第一项活动是用户保存其详细信息.单击保存按钮后,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;
}
Run Code Online (Sandbox Code Playgroud)
我知道为时已晚,但我想回答这个问题以帮助其他人,这对我有用:
Intent intent = new Intent(getContext(),OtherActivity.class);
context.startActivity(intent);
Run Code Online (Sandbox Code Playgroud)
context 是当前活动的上下文。
Mim*_*ito -1
这应该可以解决问题
Intent intent = new Intent(this, NewActivity.class);
startActivity(intent);
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
13215 次 |
最近记录: |