title: date picker value getting added to last position of dynamically inflated edittext
body: <p>I'm creating a layout which contains DOB_ Edittext.</p>
  
  <p>I'm adding layout in loop dynamically depending on the count, now the problem is when I am trying to add the value from date picker , the value always gets added to last position in edittext in the layout</p>
  
  <p>Any help is appreciated :)</p>
  
  <pre><code>    for(int children = 0; children&lt;Integer.parseInt(childrentCount)  ; children++){
          View view = inflater.inflate(R.layout.input_layout,null);
  
                    DOB_ = (EditText)view.findViewById(R.id.dob);
          final int finalChildren = children;
          DOB_.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
  
                  DOB_.setTag(finalChildren);
                  DOB_.setSelection(finalChildren);
                  setCanlenderDate();
  
               //   DOB_.requestFocusFromTouch();
              }
          });
  
          if (child_no&lt;=0){
              DOB_.setVisibility(View.GONE);
          }
  
  
  
          heading_text.setText("Children "+(children+1));
          whole_layout.addView(view);
          whole_layout.clearFocus();
      }
  
    private void setCanlenderDate() {
      Calendar calendar = Calendar.getInstance(TimeZone.getDefault());
      DatePickerDialog dialog = new DatePickerDialog(PassengerDetails.this, this,
              calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH),
              calendar.get(Calendar.DAY_OF_MONTH));
      dialog.show();
  }
  
  @Override
  public void onDateSet(DatePicker datePicker, int i, int i1, int i2) {
  
      String[] MONTHS = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
  
  
      DOB_.setText(i2 + "-" + i1 + 1 + "-" + i); // problem is here , the edittext is holding last position of inflated view
  
  }
  </code></pre>