title: getting text from dynamically added edit text in linear layout
body: <p>I have added dynamically Linear Layout which have edit field, now i want get the text from those edit fields. Here is my code for adding layout dynamically </p>
  
  <pre><code>linearLayoutForm = (LinearLayout) findViewById(R.id.linearLayoutForm);
          btnAdd.setOnClickListener(new View.OnClickListener() {
  
              @Override
              public void onClick(View v) {
                  final LinearLayout newView = (LinearLayout)getLayoutInflater().inflate(R.layout.single_skill_row, null);
                  newView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
                  ImageButton btnRemove = (ImageButton) newView.findViewById(R.id.btnRemove);
                  btnRemove.setOnClickListener(new View.OnClickListener() {
                      @Override
                      public void onClick(View v) {
                          linearLayoutForm.removeView(newView);
                      }
                  });
                  linearLayoutForm.addView(newView,0);
              }
          });
  </code></pre>
  
  <p>I have tried to get text with this code but i got null pointer exception.</p>
  
  <pre><code>register_btn.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
  
              LinearLayout et2=(LinearLayout) linearLayoutForm.getChildAt(linearLayoutForm.getChildCount());
              EditText e = (EditText) et2.getChildAt(et2.getChildCount());
              String s=e.getText().toString();
  });
  </code></pre>
  
  <p>here is XML of single_skill_row</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/rowdetail"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="horizontal"&gt;
  
      &lt;EditText
          android:id="@+id/editDescricao"
          android:layout_width="0dp"
          android:layout_height="wrap_content"
          android:layout_weight="0.62"
          android:ems="10"
          android:inputType="text"
          android:maxLines="1"&gt;
          &lt;!--&lt;requestFocus /&gt;--&gt;
      &lt;/EditText&gt;
  
      &lt;ImageButton
          android:id="@+id/btnRemove"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:contentDescription="@string/btn_remove"
          android:src="@drawable/ic_remove_black_18dp" /&gt;
  &lt;/LinearLayout&gt;
  </code></pre>