Note that my activity is NOT extending ListActivity; just Activity.
I have a list view with a custom layout as follows:
(res/layout/list_item.xml)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<ImageView
android:id="@+id/icon"
android:layout_width="30dip"
android:paddingTop="15dip"
android:layout_height="wrap_content"
android:src="@drawable/icon_default"
/>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:gravity="center_vertical"
android:paddingLeft="6dip"
android:minHeight="?android:attr/listPreferredItemHeight"
android:textColor="#ffffff"
/>
</LinearLayout>
I'm then setting the adapter for the ListView to an ArrayAdapter using an ArrayList, here called 'machines'.
ListView rooms = (ListView)findViewById(R.id.machines);
ArrayAdapter<String> aa = new ArrayAdapter<String>(getApplicationContext(), R.layout.list_item, android.R.id.text1, machines);
rooms.setAdapter(aa);
How would I go about doing a similar thing for the ImageView field?