Hi, I'm very new to Android and Java delelopment, searching and reading various tutorials and using different parts of code from around the internet, trying to make sense of it as I go. Forgive me if my explanation isn't too great.
Currently I have a list created with 4 list items, what I'd like to do is assign a different icon to each of these list items, however, I've no idea how to do it, nor do I know what to search for. Here's the code: main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/ android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <ListView android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/mainListView"> </ListView> </LinearLayout> row.xml <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/rowTextView" android:layout_width="fill_parent" android:layout_height="wrap_content" android:padding="10dp" android:textSize="16sp" > </TextView> FirstList.java import java.util.ArrayList; import java.util.Arrays; import android.app.Activity; import android.os.Bundle; import android.widget.ArrayAdapter; import android.widget.ListView; public class FirstList extends Activity { private ListView mainListView; private ArrayAdapter<String> myListAdapter; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mainListView = (ListView) findViewById( R.id.mainListView); String[] myList = new String[] {"List 1", "List 2", "List 3", "List 4"}; ArrayList<String> listObjects = new ArrayList<String>(); listObjects.addAll( Arrays.asList(myList)); myListAdapter = new ArrayAdapter<String>(this, R.layout.row, listObjects); mainListView.setAdapter(myListAdapter); } } I'd appreciate any input you have, including any resources that you may recommend or critique of my code, as a newbie I'd rather not pick up bad habits from the start! Thanks. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

