view -> parent activity

by Andrei » Thu, 22 Apr 2010 13:17:03 GMT

Sponsored Links
 If I have reference to a view that is on activity
How do I get reference to the activity from view reference?


view -> parent activity

by ~ TreKing » Thu, 22 Apr 2010 22:05:19 GMT


You don't - at least not without maintaining your own mapping or holding a
reference somewhere yourself.
I guess you COULD put the Activity reference in the view's tag ... but that
seems dirty.
Why do you need an Activity? Most everything you need is usually available
from Context, which a view has.

TreKing - Chicago transit tracking app for Android-powered devices 


Sponsored Links

Other Threads

1. Dynamically added ImageView pacement

Hey all,

I'm trying to add ImageView's dynamically, and I want them to be
placed next to each other.  Everything I try just puts them on top of
each other:

      for (int i=0; i < num_photos; i++) {

            ImageView iv = new ImageView(this);
            iv.setLayoutParams(new LayoutParams(45, 45));
            iv.setPadding(0, 0, 0, 0);

            RelativeLayout rl = (RelativeLayout) findViewById

           //I've tried:

           //I've tried:
            rl.addView(iv, 2);

           //I've tried:
            rl.addView(iv, new LayoutParams(LayoutParams.WRAP_CONTENT,


Any ideas?  Thanks in advance...


2. Cannot download SDK with eclipse 3.5 in ubuntu 9.10.

I'm having the same issue, via both http and https. Running Eclipse
3.5 and OS X 10.6.2. I have everything installed except the 0.9.4 ADT
plugin. I'm getting a Droid tomorrow so would really like to get this
working! :)


3. can't launch intent + debug problem, Source not found

4. What the actual meaning of Eclair?

5. HTC Eris no longer sending X_WAP_Profile header

6. Android SDK 2.0 Java API does support OPP?

7. What's the deal with android.intent.category.DEFAULT?