Call this method to show confirmation alert dialog. public static void alertC onfirmation( final Activity context) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setIcon(R.drawable.ic_lock_off); builder.setTitle( "Exit" ); builder.setMessage( "Are you sure?" ) .setCancelable( false ) .setPositiveButton( "Yes" , new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { //TODO your yes action } }) .setNegativeButton( "No" , new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { //TODO your no action } }); AlertDialog alert = builder.create(); alert.show(); }