More stars/occurrences on the bug report welcome: http://code.google.com/p/android/issues/detail?id=5748
On Feb 9, 6:05 pm, Bob Kerns <r...@acm.org> wrote: > The four stages of Android UI Enlightenment: > > 0) You dutifully use getApplicationContext() his Activity to pass > along to the SDK. > 1) You realize you don't NEED to call getApplicationContext() from > your Activity to pass along, 'this' should work. > 2) You realize it is WRONG to call getApplicationContext() from your > Activity to pass along, because that's not the right context to pass > along -- your Activity is. > 3) You wonder why the documentation and various failing examples keep > saying to use getApplicationContext()? > 4) I am still stuck at stage 3. Can you enlighten me? > > Really, can't someone take a half-hour and go through all the > occurrences of getApplicationContext() in documentation, Javadoc, and > examples, and fix them? Except for the Javadoc for > getApplicationContext(), nearly all occurrences should probably be > 'this'. > > On Feb 9, 1:32 pm, TreKing <treking...@gmail.com> wrote: > > > On Tue, Feb 9, 2010 at 3:24 PM, André <pha...@hotmail.com> wrote: > > > Context mContext = getApplicationContext(); > > > You're probably seeing something about a BadToken in the debug log, yes? > > DO NOT use getApplicationContext(). Use your current activity or the context > > from one of your views. > > > I swear someone runs into this every single day ... > > -- 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