• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How do I assign each of my ListView list items an individual icon?

 
Matt Fuller
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm very new to Android delelopment and relatively new to Java, 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


row.xml



FirstList.java



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.
 
Hardik Trivedi
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are using ArrayAdapter. try using Custom Array Adapter.
Google "Custom Array Adapter with ListView" there are lot of example available.

Best of luck
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic