I have a PreferentFragment whose content is loaded from a .xml file containing a CheckBoxPreference
<CheckBoxPreference
android:title="@string/pref_secure_conn"
android:key="enable_secure_connection"
android:defaultValue="false"/>
As you know, when the user interacts with this Preference, the SharedPreferences object is automatically updated so that the android:key now contains the proper Boolean.
However, I would like to use a String instead of a Boolean: Is there any way to make CheckBoxPreference use String-valued values instead of Boolean ones, so that I can later call getString with that key?
Currently, I am just listening 'onSharedPreferenceChanged' and manually changuing it, but maybe there is a better way. (Another obvious fix would be to use getBoolean instead of getString when this value is needed, but let's assume I cannot do that)