Adding a series of images in drawable folder to list view

I have currently have the same code from the android list view tutorial. I want to use the images saved in my drawable resource folder and assign each individual image to a specific row in the listview.

I have tried to put an imageview in the xml and this resulted in only the use of the same image for all rows in the list view but I need to use a different image for each row.

I feel I need to create an array of these images and then add them to the listview using the .java file associated with the listview. If anyone can help, it would be much appreciated, thanks.


First, as Mr. Roth suggests, you need a custom adapter. Here is an excerpt from one of my books that goes through that process.

With respect to:

and assign each individual image to a specific row in the listview

That is an unusual requirement. If the list will be fairly fixed, you could create an array of the resource IDs ( and build your custom ArrayAdapter around it.

Need Your Help

Slightly different execution times between python2 and python3

python testing time python-3.x execution

Lastly I wrote a simple generator of permutations in python (implementation of "plain changes" algorithm described by Knuth in "The Art... 4").

Why would jQuery.get() submit POST request?

jquery ajax post dialog get

I have some code that calls a backend method called /partner/settings to perform one of two tasks:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.