ロン 産
ロン 産

Reputation: 51

How to get the checked radio button on a custom dialog?

How could I possibly get the radiobutton that was checked in a custom dialog. I have a custom dialog with 2 radiobuttons in it but everytime I clicked the radiobutton, a null pointer exception occurs.

Upvotes: 1

Views: 675

Answers (1)

Manoj Kumar
Manoj Kumar

Reputation: 1520

While initialising the radio button use RadioButton rb = (RadioButton)dialog.findViewById(R.id.radiobutton); instead of RadioButton rb = (RadioButton)findViewById(R.id.radiobutton);

Upvotes: 1

Related Questions