To make an AlertDialog you have to write this code:
AlertDialog.Builder alertDelete = new AlertDialog.Builder(ListsActivity.this); //HERE YOU WILL WRITE THE MESSAGE YOU WANT alertDelete.setMessage(R.string.delete_confirm); //HERE IS THE POSITIVE BUTTON. YOU HAVE TO SET THE BUTTON NAME AND A CLICK LISTENER alertDelete.setPositiveButton(getString(R.string.yes),new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { //YOUR ACTION } }); //HERE IS THE CANCEL BUTTON. YOU HAVE TO SET THE BUTTON NAME AND A CLICK LISTENER alertDelete.setNeutralButton(getString(R.string.cancel),new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int i) { dialog.cancel(); } }); alertDelete.show();
And now the result: