0


I've recently started coding an app and I've come to add preferences. Now I need some kind of non-deprecated onClickListener. I want to be able to clear a set of SharedPreferences using this preference which should be handled as a button. Is that possible to do in any way AND being compatible with android 2.3 and up?

XML:

<PreferenceCategory
    android:title="Technisch" >

    <Preference
        android:key="force_update"
        android:title="Force update" />

    <Preference
        android:key="clear_settings"
        android:title="Reset antwoorden">
    </Preference>
</PreferenceCategory>

I would like to do something like getPreference("clear_settings").addOnClickListener(this); but all functions i've found either don't allow code execution OR are deprecated...

rhbvkleef
  • 214
  • 3
  • 12
  • What do you mean by non deprecated onClickListener ? What is that you are trying to implement ? – Prem Jan 09 '14 at 17:53
  • Not sure what you are referring to when you say "non-depreciated onClickListener"?? If you could be a little more specific and post the code that you are having issues with we might be able to help you more. – wyoskibum Jan 09 '14 at 17:55
  • Third'd. This doesn't really make any sense. – Nathaniel D. Waggoner Jan 09 '14 at 18:03
  • What doesn't make sense? I just want a Preference onClickListener that is not deprecated – rhbvkleef Jan 09 '14 at 18:04
  • What do you mean by a Preference onClickListener? – hichris123 Jan 09 '14 at 18:22
  • Once again, without your source code it is difficult to help. I'm guessing getPreference returns a string? typically you set a listener to a GUI widget such as a button.. – wyoskibum Jan 09 '14 at 18:37
  • getPreference() does not exist, but I want some method that listens for a touchEvent on touching the Preference. (preference is a display object, the thing you see in a lot of setting pages, with the scrollable lists) – rhbvkleef Jan 09 '14 at 18:51

0 Answers0