Thanks....I will look into implementing it the way you suggested. Mark
On Mon, Oct 31, 2011 at 10:47 AM, Mark Murphy <[email protected]>wrote: > On Mon, Oct 31, 2011 at 1:35 PM, Mark Phillips > <[email protected]> wrote: > > I think I found it......with your suggestion to look at the activity... > > > > ((Activity1)getContext()).<some public method in the Activity); > > > > Is this the best way to accomplish what I want? > > Tactically, there seem to be some scenarios in which getContext() of a > View does not return an Activity, but rather something else > (ContextWrapper, IIRC). > > Strategically, it may be cleaner for you to define an interface, have > MyHorizontalScrollView hold an instance of that interface, have your > activity supply MyHorizontalScrollView with an implementation of that > interface, and have MyHorizontalScrollView call methods on that > interface implementation as needed. In particular, I would make the > interface be "evented" -- MyHorizontalScrollView should neither know > nor care what other widgets are floating around, so it should be > surfacing events and letting the activity handle them, rather than > having the interface supply objects to MyHorizontalScrollView and > having it massage other widgets. > > -- > Mark Murphy (a Commons Guy) > http://commonsware.com | http://github.com/commonsguy > http://commonsware.com/blog | http://twitter.com/commonsguy > > _Android Programming Tutorials_ Version 4.0 Available! > > -- > 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 > -- 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

