Mark, Action with namespace works. Thanks.
Here is how the application works now. Main activity is "controlled" by SharedPreference changes: * Main activity displays a list of thingies of Type "X" * User selects the Type from a ListPreference in a PreferenceActivity with its own separate screen. If the user clicks: Menu -> Preferences -> "Select thingy type" -> "A" the preference screen appears and after "A" is selected from the ListPerference, the PreferenceActivity will finish after setResult with "A" as a parameter through an intent. This intent is to start a new Main Activity with onActivityResult. Later on, user may repeat same process with type "B". So the thingies that Main activity displays depend on when & how SharedPreferences are changed. SharedPreferences.OnSharedPreferenceChangeListener may still work for my app but user interaction flow may need changes. Thanks again. On Jul 16, 1:55 pm, Mark Murphy <mmur...@commonsware.com> wrote: > az9702 wrote: > > "user intent" in this case is an intent supplied by the application > > e.g. intent created for startActivityForResult/onActivityResult. > > OK. > > > > > The question is prompted by this scenario: > > > My "main" activity has preferences that are set by a separate > > PreferenceActivity. > > The latter sends back an intent to former via onActivityResult. > > > So in "main" activity's onCreate, it's intent > > * can be supplied by Android when the application first starts (e.g. > > on boot), or > > * can be supplied by the associated PreferenceActivity. > > > The changed Preference values can therefore be passed back to the main > > activity via > > * sharedPreferences (as Preference editor commits during > > PerferenceActivity onPause), AND > > * intent returned by PrefesrenceActivity back to the main activity in > > onActivtyResult > > > In other words, when main activity starts, it can take preference > > values either from > > * an intent or > > * shared preferences (assumed pre-existing) > > > It seems to me in onCreate of the main activity, it should > > > * take preference values from existing shared preferences on boot but > > * from intent as preference values are changed on the fly > > > So there is a need to separate intent from system & my own namespace. > > This maybe more complicated than necessary but it's how it's > > implemented for now. > > I do not know all the details of your application. Given what you wrote > above, though, I'd just register a shared preference listener and be > done with the matter: > > http://developer.android.com/reference/android/content/SharedPreferen...) > > Your main activity should neither know nor care where and how the shared > preferences get changed, just that they were changed. > SharedPreferences.OnSharedPreferenceChangeListener handles that. > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://twitter.com/commonsguy > > _Android Programming Tutorials_ Version 1.0 Available! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---