I have PreferenceActivity
, where I have the following preference:
<Preference android:key="pref_test"
android:title="@string/pref_test"
android:summary="@string/pref_test_description"
android:enabled="true"
android:persistent="true"
android:defaultValue="false"/>
How can I call it (i.e. click on the item) from the main activity? So, I will not have to re-write onPreferenceClick
code.
I've found similar question: How to open or simulate a click on an android Preference, created with XML, programmatically?, but have problem with findPreference
:
The method findPreference(String) is undefined for the type new DialogInterface.OnClickListener(){}