The error log states that your have NullPointerException
on line 54. Did you check it?
I think the code having problem is
result.setText("Correct");
It is null because you instantiate the result
by
TextView result = (TextView) findViewById(R.id.resulttext);
findViewById
is a method called on the activity, not on the Dialog
. So it return Null
if your activity does not have such TextView
.
And you should not use the Dialog
directly, according to the documentation of Dialogs. Use AlertDialog.Builder
instead:
// 1. Instantiate an AlertDialog.Builder with its constructor
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
// 2. Chain together various setter methods to set the dialog characteristics
builder.setMessage(R.string.dialog_message)
.setTitle(R.string.dialog_title);
// 3. Get the AlertDialog from create()
AlertDialog dialog = builder.create();