Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public void onBackPressed() {
- AlertDialog.Builder builder = new AlertDialog.Builder(this);
- builder.setMessage("Are you sure you want to exit?")
- .setCancelable(false)
- .setPositiveButton("Yes", new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int id) {
- MyActivity.this.finish();
- }
- })
- .setNegativeButton("No", new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int id) {
- dialog.cancel();
- }
- });
- AlertDialog alert = builder.create();
- alert.show();
- }
- @Override
- public void onBackPressed() {
- AlertDialog.Builder builder = new AlertDialog.Builder(this);
- builder.setMessage("Are you sure you want to exit?")
- .setCancelable(false)
- .setPositiveButton("Yes", new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int id) {
- //finish();
- MyActivity.this.onSuperBackPressed();
- //super.onBackPressed();
- }
- })
- .setNegativeButton("No", new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int id) {
- dialog.cancel();
- }
- });
- AlertDialog alert = builder.create();
- alert.show();
- /*
- if (handleCancel()){
- super.onBackPressed();
- }
- */
- }
- public void onSuperBackPressed(){
- super.onBackPressed();
- }
- utility.makeAlertDialog("Cancel Verification","Do you want to cancel the verification process","Cancel Verification",new DialogInterface.OnClickListener(){
- @Override
- public void onClick(DialogInterface dialog, int which) {
- utility.failureToast("OTP verification");
- Intent intent = new Intent(MobileOTPActivity.this,MobileNumberLoginActivity.class);
- intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
- startActivity(intent);
- finish();
- MobileOTPActivity.this.onBackPressed();
- }
- },"Close");
Add Comment
Please, Sign In to add comment