Wrapping a LinearLayout around a TextView
<p>I have the following code that populates a ListView with a TextView in the XML Layout file. But if I try to wrap a LinearLayout around the TextView it crashes!</p>

<p>Code:</p>

<pre><code>setListAdapter(new ArrayAdapter&lt;MyData&gt;(getApplicationContext(), R.layout.articlelist, items));        
ListView lv = getListView();
lv.setTextFilterEnabled(true);

lv.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {

        MyData d = items[position];
        Bundle bundle = new Bundle();
        bundle.putString("theArticleText", d.getText());
        Intent newIntent = new Intent(getApplicationContext(), ArticleDetail.class);
        newIntent.putExtras(bundle);
        startActivityForResult(newIntent, 0);
    }
});
</code></pre>

<p>Working XML:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:padding="10dp"
    android:textSize="16sp" /&gt;
</code></pre>

<p>Non working XML:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" &gt;
&lt;TextView
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:padding="10dp"
    android:textSize="16sp" /&gt;
&lt;/LinearLayout&gt;
</code></pre>

<p>Any ideas why this is happening??? Also what I want to do is add an icon next to each item in the list, am I heading in the right direction???</p>

<p>Cheers,</p>

<p>Mike.</p>
