[android-beginners] Re: getApplicationContext() & AlertDialog.Builder

2009-11-11 Thread Matt
@TreKing I did get the exact same error (token null is not for an application). Because of curiosity I put the following in my source code: Log.v("TAG", "this is " + this); Log.v("TAG", "getApplicationContext() is " + getApplicationContext()); I found that these two values are in fact NOT equal.

[android-beginners] Re: getApplicationContext() & AlertDialog.Builder

2009-11-11 Thread TreKing
I ran into this before. Are you seeing "token null is not for an application" in the log cat? Might be related to this thread: http://groups.google.com/group/android-developers/browse_thread/thread/7a648edddccf6f7d Specifically, this quote from Dianne: "One cause of this error may be trying to di

Re: [android-beginners] Re: getApplicationContext() & AlertDialog.Builder

2009-11-11 Thread TreKing
I ran into this issue recently. Googling around for the error led me to this thread . Specifically, the response from Dianne: "One cause of this error may be trying to display an applicationwindow/dialog throu

[android-beginners] Re: getApplicationContext() & AlertDialog.Builder

2009-11-11 Thread TreKing
Not sure why my last post did not go through ... let's try again... I had this happen as well. Googling around I found this thread: http://groups.google.com/group/android-developers/browse_thread/thread/7a648edddccf6f7d# In particular, this note from Dianne: "One cause of this error may be tryi

Re: [android-beginners] Re: getApplicationContext() & AlertDialog.Builder

2009-11-11 Thread Mark Murphy
Justin Anderson wrote: > Shoot... I was kinda hoping they were in different parts of your code. > I'm going to have to punt this one off to someone else... Since I'm being moderated (courtesy of a spammer forging my email address, apparently), this message probably will show up a day late and a e

[android-beginners] Re: getApplicationContext() & AlertDialog.Builder

2009-11-10 Thread Matt
I tried b.create().show(); but that did not solve the problem. This is very strange. If I can use 'getApplicationContext()' and 'this' interchangeably when dealing with Toast messages, I assume that those two are in fact pretty much the same. Now, on the other hand, when dealing with that AlertDi

Re: [android-beginners] Re: getApplicationContext() & AlertDialog.Builder

2009-11-10 Thread Justin Anderson
This may seem weird, but try doing this: b.create().show(); I have never actually used the show method on the Builder class (I didn't realize it existed) and have never had any problems displaying a dialog. -- There are only 10

[android-beginners] Re: getApplicationContext() & AlertDialog.Builder

2009-11-10 Thread Matt
I should mention that the runtime error does not occur in this line here AlertDialog.Builder b = new AlertDialog.Builder(getApplicationContext ()); but when calling b.show() later on. According to DDMS, the WindowManager crashes because it is trying to add a new Window (the dialog) with a token

Re: [android-beginners] Re: getApplicationContext() & AlertDialog.Builder

2009-11-10 Thread Justin Anderson
Shoot... I was kinda hoping they were in different parts of your code. I'm going to have to punt this one off to someone else... Anyone? -- There are only 10 types of people in the world... Those who know binary and those who do

[android-beginners] Re: getApplicationContext() & AlertDialog.Builder

2009-11-10 Thread Matt
I have all the following code in my onCreate() method. Toast.makeText(getApplicationContext(), "Hello World!", Toast.LENGTH_SHORT).show(); AlertDialog.Builder b = new AlertDialog.Builder(getApplicationContext ()); [Dialog configuration] b.show(); While the Toast message gets displayed right aw