Can anyone give me an example or explain me how i subscribe to the
onDialogClosed method of an EditTextPreference?
I want to know when a dialog had its OK button clicked
and then retrive the information from the EditTextPreference.
Is there any examples/tutorials of this available or can anyone point
me in the right direction?
Thank you.
Just for completion: Since
EditTextPreferenceis aPreference, you can use aOnPreferenceChangeListener. That will be called when the preference is changed. Check for the EditTextPreferences key in the callback and retrieve the new value to act on it. This is especially useful when the preference can be changed in more than one place or will be changed in the background by your app (e.g. writing defaults back when clicking a “default settings” button), since every change will trigger that callback (when your register it global on yourSharedPreferences). The onDialogClosed will only be triggered when the user closed the actual dialog.If you want to watch the single preference you can also use the
EditTextPreference.setOnPreferenceChangedListener()function to assign a listener to that preference only.OnPreferenceChangeListener documentation