There is first activity where users save their detail. after clicking save button an Alertdialog asking about ok or cancel . if user clicks on ok then a new activity get started.
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;
}
I know it's too late but I want to answer this for helping other people, this works for me :
Intent intent = new Intent(getContext(),OtherActivity.class);
context.startActivity(intent);
context is the context of the current activiy.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With