Adding image and text to listview using .csv file

Hi everyone,

I have been using App Inventor for about 2 weeks now trying to work on a project I had in my head and have been doing reasonably well by searching online and self-teaching while having absolutely 0 coding experience. :slight_smile:

I have run into a little problem though that I can't seem to solve.

I am currently making a listview which populates from a csv file. I've gotten this to work perfectly for text, but now I would like to add an image next to each text line. How? I have tried adding the image to the csv file, and it just brings up the word'Picture' in its place. I really do not want to go through and manually add the item and image individually through the 'ListData' button as the list will continue to grow and is currently at 110 items.

Is there a way to do this please?

Any help or guidance on where to look would be greatly appreciated! Thank you :slight_smile:

Show example content of your csv....

You need to use the "create Element" block (purple) to build text/image elements for the listview, and ensure that you select Main/Detail/Image from the listview menu in the designer.

Thanks for your reply.

I had a facepalm moment when I realised that I don't think a csv file would work for images because when I saved it, it looked like this:

Screenshot 2024-07-01 104203

But then it turns out like this:

Screenshot 2024-07-01 104331

Is there something else that I could try other than a .csv?

You will need the actual images somewhere, either in your media folder (assets), somewhere on your device (e.g. a shared directory) or in your ASD. You may want to download your images from an online resource on first run of your app ? Or you could use the online resource directly with urls to the image files. In your csv you can reference the image locations.

So I would need to upload the images to the App Inventor, then link them one by one in the .csv that way?

Would I just need to write "//baseset.jpg" in the csv file to access the uploaded image then? Or what would this require?

Thanks again! :slight_smile:

Yes, here is one approach:

ExampleLVWithImages.aia (3.5 KB)

Thank you very much for your help! I modified it a little bit as I wanted the list to populate as soon as the screen was opened and managed that as well.

You saved me a ton of time on this! Thanks again! :smiley:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.