开发者

URI of a preference of my own application?

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 n开发者_StackOverflow中文版ame), but what do I have to use to get the URI of the preferences of my own application? Thank you very much!


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 custom ContentProvider. There is no such functionality out of the box.


If you read documentaion of SharedPreferences:

Note: currently this class does not support use across multiple processes. This will be added later.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜