I have a problem creating a custom dialog. But I don't find the failure. Hopefully anybody can help me ...
protected Dialog onCreateDialog(int id) {
    Dialog dialog = null;
    switch (id) {
    case DIALOG_ABOUT_ID:
        dialog = buildAboutDialog();
        break;
    default:
        dialog = null;
    }
    return dialog;
}
...
public Dialog buildAboutDialog() {
    Context mContext = getApplicationContext();
    Dialog dialog = new Dialog(mContext);
    dialog.setContentView(R.layout.about_dialog);
    dialog.setTitle("About this application");
    return dialog;
}
Results in the following error:
12-30 19:27:02.593: ERROR/AndroidRuntime(383): android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
I checked if the returned dialog == null - but it isn't.
I also tried the second way (inflater) described at http://developer.android.com/guide/topics/ui/dialogs.html#CustomDialog
 
     
     
    