Trying to Read Edit box inside Custom Dialog... Getting FC
<p>I am trying to read a EditText box and send its contents to another method from within a Custom dialog box. My current code causes a Force Close. The logcat is very vague... however I know the uncaught exception takes place in this method:</p>

<pre><code>public void getName(){

         Dialog dialog = new Dialog(main.this);
         dialog.setContentView(R.layout.customdialog);
         dialog.setTitle("New Game");
         dialog.setCancelable(true);
         //there are a lot of settings, for dialog, check them all out!
         final EditText inputBox = new EditText(this);

         //set up text
         final TextView text = (TextView) dialog.findViewById(R.id.TextView01);
         text.setText("Enter Your Name...");


         //set up button
         final Button button = (Button) dialog.findViewById(R.id.namebutton);
         button.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
             String str = inputBox.getText().toString(); 
             setName(str);
        }
         });
         //now that the dialog is set up, it's time to show it    
         dialog.show();
     }
</code></pre>

<p>Here is the custom XML:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="wrap_content" android:layout_height="wrap_content"&gt;
 &lt;LinearLayout android:orientation="vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/linearLayout1"&gt;
     &lt;TextView android:text="@+id/TextView01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/nameprompt"&gt;&lt;/TextView&gt;
     &lt;EditText android:layout_width="fill_parent" android:id="@+id/editText1" android:layout_height="wrap_content" android:inputType="textPersonName" android:text="Player"&gt;
         &lt;requestFocus&gt;&lt;/requestFocus&gt;
     &lt;/EditText&gt;
     &lt;Button android:layout_height="wrap_content" android:id="@+id/namebutton" android:text="Ok" android:layout_width="fill_parent"&gt;&lt;/Button&gt;
 &lt;/LinearLayout&gt;

&lt;/RelativeLayout&gt;
</code></pre>

<p>Any ideas???</p>
