"this" is the button. How do I get the Activity that the button is
housed in inside the Button.OnClick() event handler?

On Oct 8, 11:28 pm, TreKing <treking...@gmail.com> wrote:
> On Sun, Oct 9, 2011 at 12:14 AM, John <jnb...@gmail.com> wrote:
> >  ((Activity) getApplicationContext()).startActivityForResult(intent,
> > BROWSE_FOR_FOLDER);
>
> Do not use getApplicationContext() unless you know what you're doing. It is
> the context associated with your Application, not your Activity.
>
> You need an Activity, so just use "this" - you're already running in an
> Activity, there's no reason to try using getApplicationContext().
>
> --------------------------------------------------------------------------- 
> ----------------------
> TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
> transit tracking app for Android-powered devices

-- 
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

Reply via email to