thelittlewozniak

Untitled

Jan 13th, 2019
357
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.80 KB | None | 0 0
  1. AlertDialog.Builder builder;
  2.     if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
  3.         builder = new AlertDialog.Builder(context, android.R.style.Theme_Material_Dialog_Alert);
  4.     } else {
  5.         builder = new AlertDialog.Builder(context);
  6.     }
  7.     builder.setTitle("Delete entry")
  8.     .setMessage("Are you sure you want to delete this entry?")
  9.     .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
  10.         public void onClick(DialogInterface dialog, int which) {
  11.             // continue with delete
  12.         }
  13.      })
  14.     .setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {
  15.         public void onClick(DialogInterface dialog, int which) {
  16.             // do nothing
  17.         }
  18.      })
  19.     .setIcon(android.R.drawable.ic_dialog_alert)
  20.     .show();
Advertisement
Add Comment
Please, Sign In to add comment