• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic