I'm creating a custom Dialog that contains a graphic, some text which I modify on the fly with setMessage() and a single button, labeled 'OK', which, when pressed, should dismiss the dialog and do some housekeeping. My code looks like this:
// Shows the number of letters correct in the current guess.
wdsBuilder = new AlertDialog.Builder(this);
inflater = this.getLayoutInflater();
dialogView = inflater.inflate(R.layout.box_dialog3, null);
dialogView.setBackgroundColor(Color.TRANSPARENT);
alertTextView = (TextView)dialogView.findViewById(R.id.text);
wdsBuilder.setView(dialogView).setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int whichButton) {
wdsAlert.dismiss();
if (playTimer != null) playTimer.cancel();
}
});
wdsAlert = wdsBuilder.create();
Very standard; in fact, I lifted it almost verbatim from https://developer.android.com/guide/topics/ui/dialogs.html. The dialog displays correctly and when I press 'OK' it gets dismissed, but when I put a breakpoint at wdsAlert.dismiss(), the breakpoint isn't hit. Anyone have a clue what's going on?