Dyncamically generating a List View with header
<p>I am trying to generate a ListView with a header with the data a receive during runtime. In the constructor of my ListAdapter which extends an ArrayAdapter I am doing the following:</p>

<pre><code>textViews = new TextView[tableHeaders.size()];
    for (int index = 0; index &lt; tableHeaders.size(); index++) {
        textViews[index] = new TextView(context);
        textViews[index].setWidth((((TableHeaderValues) tableHeaders
        .elementAt(index)).getHeaderWidth() * width) / 100);
        textViews[index].setSingleLine();
        linearLayout.addView(textViews[index]);
    } 
</code></pre>

<p>In my getview() method I set the text for each of the text view and I return the LinearLayout. However my output does not display all the rows. Supposing I have 3 rows, it displays only the second row and the other two rows are not visible. What could be the possible reason? Can someone kindly suggest me a better way of doing this.</p>
