I spent quite a long time trying to get my first custom dialog box to
work, following the example in the Android Dev Guide.

Specifically:

http://developer.android.com/guide/topics/ui/dialogs.html#CustomDialog
-------
Context mContext = getApplicationContext();
Dialog dialog = new Dialog(mContext);

dialog.setContentView(R.layout.custom_dialog);
dialog.setTitle("Custom Dialog");
-------

  I kept getting a badtokenexception whenever I tried to show the
dialog.

  Eventually I found a forum posting which suggested changing it to:

new Dialog(this);

  Which made the problem go away.

  My question is if the example is incorrect, or was the code not
intended to be used in an Activity method?


-Kevin



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