title: EditText setText() sets text on multiple EditText views
body: <p>I am encountering odd behavior, I suspect bug, but perhaps I am overlooking something.  Code Snippets at end of post.  I can post the .xml as well, but I don't think it's necessary to understand the issue.</p>
  
  <p>I have a horizontal linear layout, that I add TableLayouts to based upon number of players.</p>
  
  <p>The table layouts contain several fields, TextView,EditText,Buttons etc.</p>
  
  <p>When I initialize each TableLayout, I add it to the LinearLayout (via xml inflation) and then intialize the fields.</p>
  
  <p>The thing is, the EditText fields always get updated with the last players info.  From what I can tell, my call to setText is being passed to every EditText.</p>
  
  <p>I am finding the EditText using findViewById on the parent TableLayout (actually the grandparent since there is a TableRow.</p>
  
  <p>The EditText id's are not unique in the whole tree, but are unique from the table layout perspective.  </p>
  
  <p>Possible Reasons:
  1) I am getting the wrong EditText View when I findById :  This can't be it though.  I changed my code to post the objectID for the EditTextView I get IN A TEXTVIEW and I get unique object IDs.  Posting the exact same myEditText.toString() to an EditText and I get a repeating value of the last object ID used.    To Reiterate, using the exact same findView logic works whenever the field is a TextView, and displays the "multiple" setText behavior whenever it is an EditText.</p>
  
  <p>2) When I change the field from an EditText to a TextView in the xml, and then simply change my casts from EditText to TextView, everything behaves as expected.</p>
  
  <p>3) Similar lookup attempts done in my onClickListeners behave as expected.</p>
  
  <p>4) I've tried adding the view to the linear layout before initialization and after - same behavior.  I was wondering if it were an order of operations thing for the underlying objects since it worked on the listeners, but I'm still missing something.</p>
  
  <p>QUESTIONS:
  1) Does this look like a bug to anyone else?
  2) Suggested workarounds?<br>
  3) Any idea why it works in my listeners when I'm searching for my top level object, but not in my initialization code, where I explicitly have my top level object (top level object being the TableLayout that I inflated.</p>
  
  <p>CODE SNIPPETS:</p>
  
  <p>onCreate Intialization Code:</p>
  
  <pre><code>TableLayout tl = (TableLayout)inflater.inflate(R.layout.playerpanel, llayout, false);
  InitializePlayer(player1,tl);
  llayout.addView(tl);
  </code></pre>
  
  <p>InitializePlayer Snippet - where things break:</p>
  
  <pre><code>public void InitializePlayer(Player p, TableLayout tl)
  {
      players.add(p);
      tl.setTag(p);
      //INITIALIZE LISTENERS HERE - SNIPPED FOR READABILITY
  
      TextView scoreLabel = (TextView)tl.findViewById(R.id.currentScore);
      EditText curPoints = (EditText)tl.findViewById(R.id.scoreEntry);
      curPoints.setText(p.getScore());
  
  
      EditText playerEntry = (EditText)tl.findViewById(R.id.playerName);
      playerEntry.setText(tl.toString());
  
      //CONFIRMING UNIQUE OBJECTS HERE should actually be p.getScore()
      scoreLabel.setText(playerEntry.toString());
      ListView lv = (ListView)tl.findViewById(R.id.listView);
      lv.setAdapter(new ArrayAdapter&lt;String&gt;(this,R.layout.list_item, p.getTurns() ));
  </code></pre>
  
  <p>OnClickCode that does work:</p>
  
  <pre><code>private OnClickListener addButtonListener = new OnClickListener() {
      public void onClick(View v) {
        // get all the objects I care about
          TableRow tr = (TableRow)v.getParent();
          TableLayout tl = (TableLayout)tr.getParent();
          EditText ev = (EditText)tl.findViewById(R.id.scoreEntry);
          Player pl = (Player)tl.getTag();
  
          TextView scoreLabel = (TextView)tl.findViewById(R.id.currentScore);
  
          pl.addScore(ev.getText().toString());
          scoreLabel.setText(pl.getScore());
          ListView lv = (ListView)tl.findViewById(R.id.listView);
          ArrayAdapter aa = (ArrayAdapter)lv.getAdapter();
          aa.notifyDataSetChanged();
          InputMethodManager imm = (InputMethodManager)v.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
          imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
  
          EditText playerEntry = (EditText)tl.findViewById(R.id.playerName);
          playerEntry.setText(playerEntry.toString());
  
  
      }
  };
  </code></pre>