dialog.getWindow() returns null after dialog is created
<pre><code>@Override
protected Dialog onCreateDialog(int id) {
    Dialog dialog = null;
    switch(id) {
    case DIALOG_ID:
        LayoutInflater inflater = getLayoutInflater();
        View InfoLayout = inflater.inflate(R.layout.info_dialog, null);
        AlertDialog.Builder b = new AlertDialog.Builder(MyActivity.this)
                .setView(InfoLayout );
        initInfoDialog(dialog);
        return dialog;
...

private void initInfoDialog(Dialog dialog) {
    //this line has the null pointer 
    WindowManager.LayoutParams lp = dialog.getWindow().getAttributes(); 
</code></pre>

<p>Why is dialog.getWindow() returning null in this case?</p>
