title: Add TextView programatically to Listview custom row
body: <p>I want to add one TextView programatically to a Linearlayout declared in the XML file that defines a custom row  which is applied to all listview rows.
  In order to do this I have the following code:</p>
  
  <pre><code>&lt;LinearLayout
      android:id="@+id/zv"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_alignTop="@+id/title"
      android:layout_marginBottom="1dip"
      android:layout_marginLeft="5dip"
      android:layout_marginRight="5dip"
      android:orientation="vertical"
      android:padding="1dip" &gt;
  &lt;/LinearLayout&gt;
  
  class ListViewAdapter extends BaseAdapter {
  
  (...)
  public View getView(int position, View convertView, ViewGroup parent) {
          View vi=convertView;
          if (convertView == null)
              vi = inflater.inflate(R.layout.row, null);
  
          TextView tv_nz = new TextView(activity.getApplicationContext());
  
          LinearLayout zv = (LinearLayout)vi.findViewById(R.id.zv);
  
          tv_nz.setText("testing...");
          zv.addView(tv_nz);
  (...)
  
  return vi;
  }
  </code></pre>
  
  <p>However the TextView appears more than one time in every row.
  What am I doing wrong? Thanks</p>