Simple message box with no buttons
AlertDialog alertDialog;
alertDialog = new AlertDialog.Builder(this).create();
alertDialog.setTitle("Packing List");
alertDialog.setMessage("Could not find the file.");
alertDialog.show();
Message box with buttons
AlertDialog deleteAlert = new AlertDialog.Builder(this).create();
deleteAlert.setTitle("Delete List");
deleteAlert.setMessage("Are you sure you want to delete this list?");
deleteAlert.setButton("Yes", new OnClickListener(){
@Override
public void onClick(DialogInterface dialog, int which) {
//...
}
});
deleteAlert.setButton2("No", new OnClickListener(){
@Override
public void onClick(DialogInterface dialog, int which) {
//...
}
});
deleteAlert.show();