Android Question A different bitmap for every record in a listview

antsab

Member
Licensed User
Longtime User
Hi if i have a db table like this:

Name - Code - Quantity - Bitmap
Samsung 1000 1 samsung.jpg
Nokia 1001 2 nokia.jpg
.............

how can i show the image (in field bitmap i only have the name of the file not the image) in a listview having the right image for every record (es: on the line of samsung having name,code and the samsung.jpg image shown)?

Thank You
 

DonManfred

Expert
Licensed User
Longtime User
Are the images somewhere in the assets?
Are the images somewhere on your webserver?

Best way would be to put the images in a special folder in the assets and while filling the listview you can use the image from the assets.
But it would be also possible to get all the images from your webserver. Search for "downloading a lot of images"... There is somewhere a tutorial/example here to download a lot of images with httputils...
 
Upvote 0

antsab

Member
Licensed User
Longtime User
Are the images somewhere in the assets?
Are the images somewhere on your webserver?

Best way would be to put the images in a special folder in the assets and while filling the listview you can use the image from the assets.
But it would be also possible to get all the images from your webserver. Search for "downloading a lot of images"... There is somewhere a tutorial/example here to download a lot of images with httputils...

The images are on the phone in a directory where every image have the same name of the code (ES: code 0001 have image like 0001.jpg) and the name of the image is stored in the field bitmap, so when a show the listview how can i show the image of the single code?

Thank you
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Show me the code how you set the listview with name and quantity...

You can use

B4X:
lv.AddTwoLinesAndBitmap("line 1", "line 2", LoadBitmap(File.DirAssets,"001.jpg")

The "001.jpg" you have to replace with the code you get from db... db.Get("Bitmap") or whatever command you need to get this field... And the File.DirAssets should be extended with the subfolder where the image is.
 
Upvote 0
Top