I am trying to gate the title of preferencesreen in my program.. How can I get the title?
My code of preference XML is here. I want to get the title “Show List” in my program.
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory android:title="Settings">
<PreferenceScreen android:title="Show List" android:key ="show_list" android.id="@+id/preference_screen">
<intent android:action="android.intent.action.VIEW"
android:targetPackage="com.picknext"
android:targetClass="com.picknext.PickName" />
</PreferenceScreen>
<ListPreference android:title="Remove after pick"
android:key="selection_of_Y_N_Name_Pick" android:entries="@array/selection_of_y_n_namepick"
android:entryValues="@array/value_of_y_n_naempick" android:defaultValue="Yes" />
</PreferenceCategory>
</PreferenceScreen>
You probably have a class that extends PreferenceActivity. Inside this (for example in onCreate()) you have a call to addPreferencesFromResource(). After this you have access to the title via the methods getTitle() and setTitle().
I hope this helps.