Often you won't. Then someday you will, and won't know what happened to you!
Sometimes, the context you need has to be the current activity -- and it won't be. And even worse -- sometimes the context won't even be for your current application -- but rather, the first application that started in your process! Most people won't run into this -- but I have, when I started working on making my free/pro upgrade process. As near as I can tell, from the viewpoint of a user of the SDK, it is ALWAYS incorrect to use this method. Either getApplication(), the current context itself, or View.getContext() will be what you want. I don't think there are any reasonable cases where View.getContext() and the current activity itself will be different. I write <activityClass>.this if inside the activity class, and either pass in an Activity or use View.getContext() interchangeably, depending on circumstance. On Apr 3, 12:25 pm, Vladimir <[email protected]> wrote: > You're right, that was bad advice on my part, although I never had any > problems with getApplicationContext() myself. -- 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 To unsubscribe, reply using "remove me" as the subject.

