Conformation Dialogue with Yes&No button
1.This dialogue appears with two button
2.You can make use this to popup dialogue even for logout functionality
AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage("Are you sure you want to logout?") .setCancelable(false) .setPositiveButton("Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { //Do what ever you want Toast.makeText(getApplicationContext(), "Successful", Toast.LENGTH_SHORT).show(); } }) .setNegativeButton("No", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) {dialog.cancel();}}); AlertDialog alert = builder.create(); alert.show();
No comments:
Post a Comment