I am very confused as to why my dialog is not working correctly:
AlertDialog dialog;
final AlertDialog.Builder builder = new AlertDialog.Builder(this);
final CharSequence[] confirmCheckbox = {"Delete the SQLite database upon exit."};
final boolean states[] = {false};
builder.setTitle("Delete Database on Exit?");
builder.setMultiChoiceItems(confirmCheckbox, states, new DialogInterface.OnMultiChoiceClickListener(){
public void onClick(DialogInterface dialogInterface, int item, boolean state) {
}
}).setMessage("Check the checkbox below to confirm that you wish to delete the SQLite database upon exit.\n" +
"To cancel this action, hit the back button.")
.setPositiveButton(R.string.confirm_button_text, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
dialog = builder.create();
//dialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(false); <-- This will fail. BUTTON_POSITIVE is NULL
dialog.show();
The first issue I have, is that nothing shows up. I get the title, which has two strange white bars on each side of it, a black screen in the middle, and tue positive button, but I cannot reference the positive button, because i get a Null Pointer when I do.
I have read over many tutorials, and they all look similar to what I have, but I am having no luck. Any ideas?