views:

96

answers:

1

Hi Guys, i have a following ListActivity:

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Get Strings from res/strings.xml
    String items[] = { getString(R.string.mainMenu_1),
            getString(R.string.mainMenu_2), getString(R.string.mainMenu_3),
            getString(R.string.mainMenu_4), getString(R.string.mainMenu_5)};
    strings = items;

    ListAdapter listAdapter = new ArrayAdapter<String>(this,
            android.R.layout.simple_list_item_1, items);
    setListAdapter(listAdapter);
}

Displaying it and reacting to user clicks works great, now I want to add some pictures before the text (like "Settings"). can someone explain me how to do this? (How to get pictures from res/drawable isn needed to get explained ;-))

greets, poeschlorn

+2  A: 

You have to make your own ListAdapter. Here's a fine tutorial about this: http://www.anddev.org/novice-tutorials-f8/iconified-textlist-the-making-of-t97.html?sid=57c1096099cb666b386eb4ab65aba0c6

YaW
hi thanks, I think that's exactly what I needed. I'm gonna try this out. If I had one more reputaion, I would give you an upvote ;-)
poeschlorn
You can always mark the question as answered by clicking the tick left to the question, this gives you and YaW some reputation and it shows us that the questions is answered.
Janusz