title: AlertDialog Builder Control Access
body: <p>I have a Custom AlertDialog.Builder but I couldn't reach the EditText.</p>
  
  <p>This is my DEFAULT Class;</p>
  
  <pre><code>        AlertDialog.Builder Builder = new AlertDialog.Builder(this);
  
          LayoutInflater Inflater = this.getLayoutInflater();
  
          View AddCategory = Inflater.inflate(R.layout.category_new, null);
  
          final EditText etCategoryName = (EditText) AddCategory.findViewById(R.id.btnAddCategory);
  
          Builder.setView(AddCategory)
          .setTitle("Add Category")
          .setPositiveButton("ADD", new DialogInterface.OnClickListener() {
              public void onClick(DialogInterface dialog, int id) {
                  Time Today = new Time(Time.getCurrentTimezone());
                  Today.setToNow();
  
                  //This code has error !...
                  String CategoryName = etCategoryName.getText().toString();
              }
          })
          .setNegativeButton("CANCEL", new DialogInterface.OnClickListener() {
              public void onClick(DialogInterface dialog, int id) {
                  dialog.cancel();
              }
          }); 
  
          Builder.show();
  </code></pre>
  
  <p>This
  String CategoryName = etCategoryName.getText().toString();</p>
  
  <p>This is my Costum AlertDialog layout;</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="match_parent"
  android:layout_height="60dp" &gt;
  
  &lt;TextView
      android:id="@+id/tvAddCategoryName"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_alignParentLeft="true"
      android:layout_alignParentTop="true"
      android:layout_marginLeft="10dp"
      android:layout_marginTop="15dp"
      android:text="@string/AddCategoryName"
      android:textColor="@color/White"
      android:textAppearance="?android:attr/textAppearanceMedium" /&gt;
  
  &lt;EditText
      android:id="@+id/etAddCategoryName"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_alignBaseline="@+id/tvAddCategoryName"
      android:layout_alignBottom="@+id/tvAddCategoryName"
      android:layout_toRightOf="@+id/tvAddCategoryName"
      android:layout_marginLeft="20dp"
      android:hint="@string/CategoryName"
      android:ems="10" &gt;
  
      &lt;requestFocus /&gt;
  &lt;/EditText&gt;
  </code></pre>
  
  <p></p>
  
  <p>Please help me ...</p>