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 don't.
----------------------------------------------------------------------


On Tue, Nov 10, 2009 at 1:27 PM, Matt <[email protected]> wrote:

> 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 away, the AlertDialog
> won't. Instead there is a runtime error. Like I said, if you replace
> the "getApplicationContext()" with "this", it works flawlessly.
>
>
>
> On 10 Nov., 20:44, Justin Anderson <[email protected]> wrote:
> > That's interesting.  I've never run into that problem before.  It
> probably
> > has something to do with what classes you are in or something like that.
> >
> > Here's a question... did you try the Toast in the same place where using
> > AlertDialog.Builder gives an error or were they in different parts of
> your
> > code?
> >
> > Thanks,
> > Justin
> >
> > ----------------------------------------------------------------------
> > There are only 10 types of people in the world...
> > Those who know binary and those who don't.
> > ----------------------------------------------------------------------
> >
> > On Tue, Nov 10, 2009 at 12:16 PM, Matt <[email protected]> wrote:
> > > Hi everybody,
> >
> > > can somebody please explain why
> >
> > > AlertDialog.Builder b = new AlertDialog.Builder(getApplicationContext
> > > ());
> >
> > > will result in a runtime error, while
> >
> > > AlertDialog.Builder b = new AlertDialog.Builder(this);
> >
> > > will run just fine? I can use "this" and "getApplicationContext()"
> > > with Toast.makeText() interchangeably without any problems. What is
> > > different with that AlertDialog.Builder? Any ideas?
> >
> > > Cheers, Matt
> >
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "Android Beginners" group.
> > > To post to this group, send email to
> [email protected]
> > > To unsubscribe from this group, send email to
> > > [email protected]<android-beginners%[email protected]>
> <android-beginners%[email protected]<android-beginners%[email protected]>
> >
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-beginners?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Beginners" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-beginners%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-beginners?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" 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-beginners?hl=en

Reply via email to