title: Android - Access an object added after the activity has launched
body: <p>I'm a beginner in Android development and would appreciate your help on this one.</p>
  
  <p>I have an android activity that creates a Checkbox and an EditText when the user clicks on a button. The user is free to add as many Checkboxes/EditTexts he likes.</p>
  
  <p>This is the xml file of the view that is being added to the activity:</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/LinearLayout1"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical" &gt;
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content" &gt;
  
          &lt;CheckBox
              android:id="@+id/checkBox1"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content" /&gt;
  
          &lt;EditText
              android:id="@+id/editText1"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_weight="1"
              android:ems="10" &gt;
  
              &lt;requestFocus /&gt;
          &lt;/EditText&gt;
  
      &lt;/LinearLayout&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>This is the java code :</p>
  
  <pre><code>public void onclickplus (View view){
  
          LayoutInflater inflate = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
          final View view1 = inflate.inflate(R.layout.row_checkitem, null);
          mainLayout.addView(view1);
          count = count +1;
  
  }
  </code></pre>
  
  <p><em><strong>My question is , how do we access these checkboxes and EditTexts added, in the actual java code so that i can save their data to my database.</em></strong></p>
  
  <p>If these objects where predetermined i would do for example :</p>
  
  <pre><code>EditText text1;
  text1 = (EditText) findViewById(R.id.editText1);
  text1.getText().toString();
  </code></pre>
  
  <p>and so on ,to access an editText's value.</p>
  
  <p>In this case however , these objects are not there when the activity is launched.</p>
  
  <p>Can you help me out?
  Thanks.</p>