I am trying to open programmatically the ListPreference that exist inside the PreferenceCategory. The XML structure looks something like this:
<PreferenceScreen
android:key="pref_screen" >
<PreferenceCategory
android:title="Category"
andorid:key="pref_category">
<ListPreference
android:key="pref_list"
android:title="List" />
</PreferenceCategory>
</PreferenceScreen>
My goal is to open the "pref_list" programmatically and display it to the user. I looked through this thread suggesting this solution:
PreferenceScreen screen = (PreferenceScreen) findPreference("pref_screen");
int pos = findPreference("pref_list").getOrder();
screen.onItemClick( null, null, pos, 0 );
This works fine for a PreferenceScreen without a PreferenceCategory, but I can't get it to work for my case (when the ListPreference is inside the PreferenceCategory).
How can I change this for my case? Or is there another solution?
PreferenceCategory , onItemClick() PreferenceScreen. "pos" getOrder() PreferenceCategory .