Based on the source code, unless you have done some fairly strange things involving Loopers, onSharedPreferenceChanged() is called on the main application thread.
On Fri, May 6, 2011 at 4:44 AM, laborg <gerhard.aig...@gmail.com> wrote: > Hi! > > The API (http://developer.android.com/reference/android/content/ > SharedPreferences.OnSharedPreferenceChangeListener.html) states that > onSharedPreferenceChanged is run on "your main thread". With this > believe I implemented a activity which is registered as a > SharedPreferenceListener within onStart and unregistered in onStop. > When a broadcast receiver changes the sharedPreference of interest I > receive an exception > "android.view.ViewRoot$CalledFromWrongThreadException: Only the > original thread that created a view hierarchy can touch its views." > > Why is this? I'm aware of the fact to use handlers for this kind of > problem but is the API wrong or do I misinterpret the writing "your > main thread" ? I read it as: "Since it's on the main thread you don't > have to worry..." > > best reagards, > Gerhard > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _Android Programming Tutorials_ Version 3.4 Available! -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en