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?

Thanks!

Mark

On Mon, Oct 31, 2011 at 10:30 AM, Mark Phillips
<[email protected]>wrote:

> My apologies for not being clear. I an very new to android development -
> this is my second week of experimenting/reading.
>
> I assume there is a "pattern" for accessing a view_1 from view_2, where
> view_1 is not a child of view_2. Perhaps I am wrong.
>
> I was thinking that in the constructor of view_2, there is this Context
> object. I looked at the api and I don't see anything obvious, but is there
> a way through that object to get a handle on the activity so I can call
> activity.findViewById() in view_2 to get at view_1?
>
> Or, is the pattern to create a getter in the activity, which calls
> findViewById() for view_1, and then somehow view_2 calls that getter.
> Again, not sure how to get a handle to the activity in view_2.
>
> Thanks,
>
> Mark
>
>
> On Mon, Oct 31, 2011 at 9:28 AM, Mark Murphy <[email protected]>wrote:
>
>> On Mon, Oct 31, 2011 at 11:55 AM, Mark Phillips
>> <[email protected]> wrote:
>> > How do I get it from my activity?
>>
>> Call findViewById() on the activity.
>>
>> --
>> 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

Reply via email to