Populating custom listview
<p>I would like to create a listview with custom rows. I have created a class that extends <code>ListActivity</code> and an XML for each row item. I've also added a method that generates some dummy data. But this is where I'm stuck. How do I call this from my main class and populate a listview in my <code>main.xml</code>?</p>

<p><strong>CustomListView.java</strong></p>

<pre><code>public class CustomListView extends ListActivity  {

private ArrayList&lt;HashMap&lt;String,String&gt;&gt; list;

public CustomListView(){

    list =  new ArrayList&lt;HashMap&lt;String,String&gt;&gt;();

    SimpleAdapter adapter = new SimpleAdapter(
            this,
            list,
            R.layout.custom_list_item,
            new String[] {"pen","price","color"},
            new int[] {R.id.text1,R.id.text2, R.id.text3});

    populateList();

    setListAdapter(adapter);

}

private void populateList() {

    HashMap&lt;String,String&gt; temp = new HashMap&lt;String,String&gt;();
    temp.put("pen","MONT Blanc");
    temp.put("price", "200.00$");
    temp.put("color", "Silver, Grey, Black");
    list.add(temp);
    HashMap&lt;String,String&gt; temp1 = new HashMap&lt;String,String&gt;();
    temp1.put("pen","Gucci");
    temp1.put("price", "300.00$");
    temp1.put("color", "Gold, Red");
    list.add(temp1);
    HashMap&lt;String,String&gt; temp2 = new HashMap&lt;String,String&gt;();
    temp2.put("pen","Parker");
    temp2.put("price", "400.00$");
    temp2.put("color", "Gold, Blue");
    list.add(temp2);
    HashMap&lt;String,String&gt; temp3 = new HashMap&lt;String,String&gt;();
    temp3.put("pen","Sailor");
    temp3.put("price", "500.00$");
    temp3.put("color", "Silver");
    list.add(temp3);
    HashMap&lt;String,String&gt; temp4 = new HashMap&lt;String,String&gt;();
    temp4.put("pen","Porsche Design");
    temp4.put("price", "600.00$");
    temp4.put("color", "Silver, Grey, Red");
    list.add(temp4);

}

}
</code></pre>

<p><strong>custom_list_item.xml</strong></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="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" &gt;

&lt;TextView android:id="@+id/text1" 
android:textSize="16sp" 
android:textStyle="bold" 
android:textColor="#FFFF00" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent"/&gt;

&lt;TextView android:id="@+id/text2"
android:textSize="12sp" 
android:textStyle="bold" 
android:layout_width="wrap_content" 
android:layout_height="fill_parent"/&gt;

&lt;TextView android:id="@+id/text3" 
android:typeface="sans"
android:textSize="14sp"
android:textStyle="italic"
android:layout_width="wrap_content" 
android:layout_height="wrap_content"/&gt;
</code></pre>

<p></p>
