Kostya, I like your second suggestion.
So in my Preference Activity's onCreate() I should get every preference by original key name and then reset the key name to include the widget. That means I'll have a full set of non-unique preference keys without any data but that should not really be an issue. According to the docs it does not look like there is a method to iterate through "all preferences" so, instead, I'll have to get every preference by specific key name and manually change each one. Have I missed a more direct way of changing all the keys? If I use an onClickListener() and on SharedPreferenceChangeListener() to detect specific preference clicks or changes to a preference, I can parse out the widget ID from the key so that I know which specific widget has been effected. I can then make sure that I update just that specific widget accordingly. Can you think of a better way to do that? To facilitate parsing out the widget id, I have already externalized all my key names as string resources so that I can edit the string to include a ":". This way I can parse out the text that follows the ":" and get the widget id. Did you do something similar or did you not have the need to know which widgetid has had its preference changed? ...Jake >>>>> "KV" == Kostya Vasilyev <[email protected]> writes: KV> Jake, KV> It's possible to make your subclass of PreferenceActivity use a KV> specific preference file by putting something like this inside KV> its onCreate: KV> PreferenceManager prefManager = getPreferenceManager(); KV> prefManager.setSharedPreferencesName("widget_pref_" + KV> String.valueOf(widgetId)); KV> This seems somewhat inefficient though, because each widget will KV> get its own preference storage file. KV> To use a single preference file where each widget gets its own KV> set of keys (dependent on a particular widget id), you could try KV> using Preference.setKey: KV> for preference : all Preferences in the screen { KV> String keyOriginal = preference.getKey(); KV> String keyWithWidgetId = keyOriginal + String.valueOf(widgetId); KV> preference.setKey(keyWithWidgetId); KV> } KV> Hope this helps. KV> -- Kostya KV> 24.04.2011 17:28, Jake Colman пишет: >> I currently use a Preference Activity and a preference XML file to >> manage my preferences. Since a Preference Activity handles edits >> on its own, is there still a way to use it if I need to change the >> key name at runtime to have a widget id? I am pretty sure I can >> get the widget from the intent since it is launched as a >> configuration activity but can I tap in and use it? KV> -- KV> Kostya Vasilyev -- http://kmansoft.wordpress.com KV> -- KV> You received this message because you are subscribed to the Google KV> Groups "Android Developers" group. KV> To post to this group, send email to [email protected] KV> To unsubscribe from this group, send email to KV> [email protected] KV> For more options, visit this group at KV> http://groups.google.com/group/android-developers?hl=en -- Jake Colman -- Android Tinkerer -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

