title: Android: Find an ID of dynamically created view
body: <p>I've got a following problem:</p>
  
  <p>In Android Studio I generate en <code>EditText</code> dynamically when an <code>ExerciseButton</code> is clicked:</p>
  
  <pre><code>public void exerciseButtonClick(View view) {
    EditText exercise = new EditText(this);
    exercise.setId(exerciseId);
    exerciseId++;
  }
  </code></pre>
  
  <p>Later in the code I would like to refer to all my <code>EditText</code>'s via ID. I'm trying something like this but this is not working:</p>
  
  <pre><code>for (int i = 1; i &lt; exerciseId; i++) {
                  EditText currentEditText = (EditText) findViewById(i);
                  // further instructions on that EditText
  }
  </code></pre>
  
  <p>The error is of course here: <code>findViewById(i)</code>, showing <strong>Expected resource type to be on of id</strong>. How can I solve this problem?</p>