AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setView(R.layout.custom_dialog); builder.setPositiveButton("Confirm", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // Some action for the confirm button } }); builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // Some action for the cancel button } }); AlertDialog dialog = builder.create(); dialog.show();In this example, the R.layout.custom_dialog XML file contains an ImageView and TextView that will be displayed in the custom content area of the AlertDialog. The package library used for this method is android.app.AlertDialog.Builder.