findviewbyid returns null in a dialog
<p>I have a custom dialog and when I try to get the value of an EditText it returns null.</p>

<p>This line returns null</p>

<pre><code>EditText et = (EditText)findViewById(R.id.username_edit);
</code></pre>

<p>Here is the code in its entirety.</p>

<pre><code>protected Dialog onCreateDialog(int id) {
    switch (id) {
    case DIALOG_TEXT_ENTRY:
        LayoutInflater factory = LayoutInflater.from(this);
        final View textEntryView = factory.inflate(R.layout.alert_dialog_text_entry, null);
        return new AlertDialog.Builder(TicTacToe.this)
            //.setIconAttribute(android.R.attr.alertDialogIcon)
            .setTitle(getTitleText())
            .setView(textEntryView)
            .setPositiveButton("JOIN GAME", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int whichButton) {
                    try
                    {
                        EditText et = (EditText)findViewById(R.id.username_edit);
                            playerName = et.getText().toString();
                    }
                    catch (Exception e)
                    {
                    }
                }
            })
            .create();
    }
    return null;
}
</code></pre>
