开发者

Multiple instances of the same android widget: Anyway way to have instance specific preferences?

I am creating a simple Android widget with a typical usecase of having many instances of it running at once.

Using the stock preferencesmanager, it seems each instance of the widget shares the same preferences.

Is there any way to not have this happen?

Thanks开发者_JAVA技巧!


You can try overriding getPreferenceManager() in your PreferenceActivity, and return a custom PreferenceManager in which you have overridden getPreferences() to return a different SharedPreferences object for each app widget. I have not tried this, so I am not completely certain it will work. If it does, and you think of it, comment on this answer to let me know!

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜