title: Dynamically add edit text to a layout
body: <p>I am trying to add an edit text view dynamically to a layout from the java class. However from what I have implemented nothing changes on my action. This is what I have:</p>
  
  <pre><code>public final void onCreate(final Bundle i){
      int value = 0;
  
      isEdit = false;
  
      try
      {
          super.onCreate(i);
  
          this.setContentView(R.layout.contactedit);
          ContactList.soundIndicator = 0;
          etPhoneNumber = new ArrayList&lt;EditText&gt;();
          this.etPhoneNumber.add((EditText) this.findViewById(R.id.etPhoneNumberInput));
  
          this.addNumberBtn = (Button) this.findViewById(R.id.addNumberEditText);
          addNumberBtn.setOnClickListener(new View.OnClickListener() {
  
              public void onClick(View v) {
                  //etPhoneNumber.add(new EditText(ContactEdit.this));
                  try{
                      LinearLayout layout = (LinearLayout) findViewById(R.id.contacteditll);
  
                      EditText temp = new EditText(ContactEdit.this);
                      temp.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,
                              LayoutParams.WRAP_CONTENT));                
  
                      etPhoneNumber.add(temp);
  
                      layout.addView(temp);
                  }catch(Exception e){
                      Log.d(TAG, "Failed to create new edit text");
                  }
              }
          });
  }
  </code></pre>
  
  <p>This is the xml:</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" 
    android:baselineAligned="true" 
    android:orientation="vertical"
    android:id="@+id/contacteditll"
    android:background="@drawable/darkimg"&gt;
  
         &lt;TextView
          android:id="@+id/titlePrint"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:text="@string/titlePrompt"
          /&gt;
  
        &lt;Spinner 
          android:id="@+id/spContactTitle"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:prompt="@string/titlePrompt"
          /&gt;
  
      &lt;TextView 
       android:text="@string/namePrint"
       android:id="@+id/namePrint" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content"&gt;
       &lt;/TextView&gt;
  
      &lt;EditText android:layout_width="match_parent" 
      android:hint="@string/returnName" 
      android:id="@+id/etFirstNameInput" 
      android:layout_height="wrap_content"
      android:layout_toRightOf= "@+id/namePrint"&gt;
      &lt;/EditText&gt;
  
       &lt;TextView 
       android:text="@string/secondPrint"
       android:id="@+id/secondPrint" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content"&gt;
       &lt;/TextView&gt;
  
      &lt;EditText android:layout_width="match_parent" 
      android:hint="@string/returnName" 
      android:id="@+id/etSecondNameInput" 
      android:layout_height="wrap_content"
      android:layout_toRightOf= "@+id/namePrint"&gt;
      &lt;/EditText&gt;
  
      &lt;TextView android:id="@+id/numberPrint"
      android:layout_height="wrap_content" 
      android:layout_width="wrap_content" 
      android:text="@string/numberPrint"&gt;
      &lt;/TextView&gt;
  
      &lt;EditText android:layout_height="wrap_content" 
      android:layout_width="match_parent" 
      android:id="@+id/etPhoneNumberInput" 
      android:hint="@string/returnNumber"&gt;
      &lt;/EditText&gt;
  
      &lt;Button android:id="@+id/addNumberEditText"
      android:layout_height="wrap_content" 
      android:layout_width="wrap_content"
          android:freezesText="true"
      android:editable="false"
      android:text="ADD"
      /&gt;
  
  
       &lt;include 
       android:id="@+id/customedittext"
       layout="@layout/myedittext"/&gt;
  
      &lt;TextView android:id="@+id/emailPrint" 
      android:layout_height="wrap_content" 
      android:layout_width="wrap_content" 
      android:text="@string/emailPrint"&gt;
      &lt;/TextView&gt;
  
      &lt;EditText android:layout_height="wrap_content" 
      android:layout_width="match_parent" 
      android:id="@+id/etEmailAddressInput" 
      android:hint="@string/returnEmail"&gt;
      &lt;/EditText&gt;
  
      &lt;Button 
      android:freezesText="true"
      android:editable="false"
      android:layout_gravity="center" 
      android:layout_height="wrap_content" 
      android:id="@+id/btnSaveButton" 
      android:layout_width="wrap_content"  
      android:text="@string/save"
      android:layout_below="@+id/emailInput" 
     /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Whenever I click on my button the action is heard but nothing is done. The layout of the page does not change even though the new edit text is in my list of edit texts and I am adding the new edit text to the layout.</p>
  
  <p>Any help would be appreciated thanks.</p>