Android CheckBoxPreference As RadioButton

While there is now RadioButton Preference widget in Android, you can use the existing CheckBoxPreference widget, add the same OnPreferenceClickListener and add a little code to ensure that only one CheckBox gets clicked.

To start with, here is a sample of a preference XML file.

And in the onCreate() method, you can do it like this:

That should do it.

Related Posts Plugin for WordPress, Blogger...

Leave a Reply

Your email address will not be published. Required fields are marked *