Hi all,
How would i change an imageview depending on data in a program.
I have 16 imageviews labelled imageView1......to....imageView16
can i declare an imageview in a sub and then assign a particular imageView1-16 to the imageview i have just declared.
it is so i don't have to repeat code over and over
my thought process is below:
How would i change an imageview depending on data in a program.
I have 16 imageviews labelled imageView1......to....imageView16
can i declare an imageview in a sub and then assign a particular imageView1-16 to the imageview i have just declared.
it is so i don't have to repeat code over and over
my thought process is below:
B4X:
Sub Draw_Image (pos as int, cView as Boolean)
Dim curIm As ImageView
If pos = 1 then curIm = ImageView1
If pos = 2 then curIm = ImageView2
If pos = 3 then curIm = ImageView3
If pos = 4 then curIm = ImageView4
If cView = true Then
curIm.Bitmap = LoadBitmap(File.DirAssets,"picture1.png")
Else
curIm.Bitmap = LoadBitmap(File.DirAssets,"picture2.png")
End If
End Sub
Last edited: