// create an instance of AlertDialog.Builder AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this); builder.setMessage("Are you sure you want to delete this item?") .setTitle("Delete item") .setCancelable(false) .setPositiveButton("Delete", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // delete item } }) .setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // dismiss dialog dialog.dismiss(); } }); // create and show dialog box AlertDialog dialog = builder.create(); dialog.show();In this example, the android.app package is used for the AlertDialog class. The builder is used to create a new AlertDialog with a message, title, and buttons for the user to click. The dialog is shown on the screen using the `dialog.show()` method. When the "Cancel" button is clicked, the `dialog.dismiss()` method is called to close the dialog box.