I had the same issue in my activity.

I replaced new Dialog(getApplicationContext())
with new Dialog(this)

and it worked.
-Peter

On May 7, 7:46 am, "L'\\tty" <[email protected]> wrote:
> Hi guys,
>
> I tried to create a custom about dialog using the source code of
>
> http://developer.android.com/guide/topics/ui/dialogs.html#CustomDialog
>
> with the result that I get a BadTokenException and the message that
> the view cannot be null. If I understood it correctly, the
> custom_dialog.xml is a new layout file containing just the information
> for the dialog and the layout_root id is not needed for the first
> solution.
>
> The code from step 2 should be in the class where I want to display
> the dialog right? At least I put it in the onCreateDialog(int id)
> method.
>
> I also tried to implement a custom alert dialog that actually lead to
> the same problem. However, the system did not know the
> LAYOUT_INFLATER, is this a self defined variable or where do I get
> this attribute from?
>
> Anyhow it seems that the dialogs have problems setting a view. Does
> anybody know this error and how to avoid it?
>
> Regards

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

Reply via email to