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.

A great helper function to get the value of the selected radio button. Note that radio button groups can only have one value whereas checkboxes can have multiple values. These functions are from this link.

Related Posts Plugin for WordPress, Blogger...