For my android application I store a preference, lets call it “test_preference”. Now I need the URI of this preference, so I can set up a ContentObserver for this preference. But how do I get the URI? For android system settings there’s Settings.System.getUriFor(String name), but what do I have to use to get the URI of the preferences of my own application? Thank you very much!
For my android application I store a preference, lets call it test_preference. Now I
Share
If you want to observe changes of this preference in your own application, just use
SharedPreferences.registerOnSharedPreferenceChangeListener(). If you want to observe changes of this preference outside your application, then your should implement it yourself via customContentProvider. There is no such functionality out of the box.If you read documentaion of
SharedPreferences: