i created a dialog box and i press it for the first time it shows my dialog box correctly, but when i close it with phone's back button and press it again, the dialog does not appear and the app crash. Why is my code not working? I got the error mentioned in the title.
There is my code:
final AlertDialog.Builder raspunsgresit = new AlertDialog.Builder(Intrebarea341.this);
LayoutInflater factory = LayoutInflater.from(Intrebarea341.this);
final View view = factory.inflate(R.layout.raspuns341, null);
raspunsgresit.setView(view);
raspunsgresit.setPositiveButton("", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dlg, int sumthin) {
finish();
}
});
And there i show it:
btnIncrement.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//RASPUNS CORECT
if (!i1.isChecked() && i2.isChecked() && !i3.isChecked()) {
raspunscorect.show();
} else if (i1.isChecked() && i2.isChecked()) {
raspunsgresit.show();
} else if (i1.isChecked() && i3.isChecked()) {
raspunsgresit.show();
} else if (i2.isChecked() && i3.isChecked()) {
raspunsgresit.show();
} else if (i1.isChecked() && i2.isChecked() && i3.isChecked()) {
raspunsgresit.show();
} else if (i1.isChecked()) {
raspunsgresit.show();
} else if (i2.isChecked()) {
raspunsgresit.show();
} else if (i3.isChecked()) {
raspunsgresit.show();
}
}
});
}