EditText Field Is Crashing My Android App
<p>Hi all i have updated my post to show the full xml file, which will show if i am doing something wrong. </p>

<p>i implemented a custom dialog with an edit text field and it keeps crashing. I will
 also like to access the values filled in the text field. Any idea where i am going wrong? Thanks.</p>

<p>Below is the offending/troublesome??? code</p>

<p>First i show the xml file which contains my layout for the alert dialog.</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;ImageView android:id="@+id/ImageView01"
  android:layout_width="wrap_content" android:layout_height="wrap_content"
   android:layout_centerHorizontal="true" /&gt;

 &lt;ScrollView android:id="@+id/ScrollView01"
   android:layout_width="wrap_content" android:layout_below="@+id/ImageView01"
    android:layout_height="200px"&gt;

   &lt;TextView android:text="@+id/TextView01" android:id="@+id/TextView01"
   android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt;

   &lt;EditText 
   android:id="@+id/lastname"
    android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:hint="blah"
    /&gt;
   &lt;/ScrollView&gt;

 &lt;Button android:id="@+id/Button01" 
 android:layout_below="@id/ScrollView01"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
  android:layout_centerHorizontal="true"
   android:text="Cancel" /&gt; 
  &lt;/RelativeLayout&gt;
</code></pre>

<p>Then main activity file which implements
 my button click events...etc.
          .......</p>

<pre><code>    setContentView(R.layout.main);
    //this button will show the dialog
    Button button1main = (Button) findViewById(R.id.Button01main);

    button1main.setOnClickListener(new View.OnClickListener() {

        public void onClick(View OnClickListener) {
            //set up dialog
            final Dialog dialog = new Dialog(MoredialogActivity.this);
            dialog.setContentView(R.layout.maindialog);
            dialog.setTitle("This is my custom dialog box");
            dialog.setCancelable(true);



            TextView text = (TextView) dialog.findViewById(R.id.TextView01);
            text.setText(R.string.lots_of_text);

            //set up image view
            ImageView img = (ImageView) dialog.findViewById(R.id.ImageView01);
            img.setImageResource(R.drawable.icon);

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

                public void onClick(View v) {
                    dialog.dismiss();
                    //finish();
                }
            });

            dialog.show();
        }
    });
}
</code></pre>

<p>}</p>
