title: Dynamically added rows, setOnClickListener TextView
body: <p>I have a for loop that each time prints out a row with a TextView within. I want this TextView to be clickable, and when clicked it is supposed to start another activity and send an ID with the Intent. But it's this that I can't manage to work. All links shows up nicely in a table and the textviews are clickable, but all links sends me to the next activity with the same ID, the ID of the last link.</p>
  
  <p>Here is a simplified version of the content of the for loop:</p>
  
  <pre><code>TextView title = new TextView(this);
  title.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
  title.setText(titleLine);
  title.setClickable(true);
  title.setId(rows);
  rows++;
  
  title.setOnClickListener(new View.OnClickListener() {
  
      @Override
      public void onClick(View v) {
          Intent myIntent = new Intent(a.this, b.class);
          myIntent.putExtra("id", idLine);
          a.this.startActivity(myIntent);
      }
  });
  
  contRight.addView(title);
  </code></pre>
  
  <p>I suppose the problem is that all textViews looks the same, so the last setOnClickListener works on all links. However, I have added an ID to each title, with this code: <em>title.setId(rows);</em>, so they are all supposed to be unique.</p>
  
  <p>Anybody who can give some help? :) Thanks!</p>