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!
精彩评论