Android Question Adding an image

Sam H

Member
Licensed User
Longtime User
I really shouldn't be having problems with this but I would like to place an image in my app, and what should be a 5 minute task is proving really difficult.

I would like the equivalent of this in HTML <img src="url"alt="some_text">.

I have tried this:

Dim GraphIcon As Bitmap = LoadBitmap(File.DirAssets, "graphIcon.bmp")
Activity.AddView(GraphIcon, 5%x, 5%y, 40%x, 25%y)

however it doesn't compile due a type mismatch error. What is the simplest way to do this. I have tried creating a canvas but that didn't get me anywhere. I was hoping there would be a tutorial on this.

Thanks

Sam
 

DonManfred

Expert
Licensed User
Longtime User
Use an IMAGEVIEW and load the bitmap into the imageview
 
Upvote 0

RandomCoder

Well-Known Member
Licensed User
Longtime User
If you plan to allow screen rotations or want to change the Bitmap then it might be better to LoadBitmapSample into a Process Global Bitmap, that way you can hopefully avoid Out Of Memory Errors as all too often occur when working with Bitmaps.
 
Upvote 0
Top