> On Mon, Jul 5, 2010 at 12:55 PM, Mark Murphy <[email protected]> wrote: > > On Mon, Jul 5, 2010 at 4:04 AM, Federico Paolinelli <[email protected]> > > wrote: > >> However, is there another way to do this? Am I missing something? > > > You can create a custom preference, perhaps subclassing an existing > > one, and implement your business logic there. See here for a custom > > View that I wrapped into a ColorPreference: > > >http://github.com/commonsguy/cwac-colormixer
After looking at the source code, I managed to get it work using the PreferenceActivity with DefaultSharedPreferences. I write for those who might be interested in this. The editor.commit() call calls the listener after storing the new values, so what I was doing was basically correct. A new editor.commit() call inside the listener forces the SharedPreferences to a different value from the one that is being notified (to be more precise, to the one related to the key that is being notified). What I did not consider, is that the activity view does not get updated if I change the preferences from the listener. So the preference stored was ok but the view was showing an incorrect value. I resolved reloading the whole activity using : startActivity(getIntent()); finish(); Federico -- 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

