I have the need to load a variable number of ImageView in a panel. I tried using two way but in both cases is the same error occurs, or the loading of the second image from an exception error FileNotFound (name file.png).
At first I thought of an error in the file name, but failing to find no error I tried to change the order (bar, market in this case the bar is loaded, market goes wrong) instead of using (market, bar in this case market is loaded bar goes wrong).
In the first case I used an array of images, in the second case a list of images
The variable "servizi" contains entries of images
this is the second way using a list
I hope that the solution is not the type
I forgot to say that all the images are loaded into serving designer of Activity
At first I thought of an error in the file name, but failing to find no error I tried to change the order (bar, market in this case the bar is loaded, market goes wrong) instead of using (market, bar in this case market is loaded bar goes wrong).
In the first case I used an array of images, in the second case a list of images
The variable "servizi" contains entries of images
B4X:
Dim img(servizi.lenght) as imageview
For n=0 to servizi.lenght -1
img(n).initialize(“img”)
img.Gravity =Gravity.FILL
img.Bitmap =LoadBitmap(File.DirAssets ,servizi(n) &".png") 'Error when load second image
Pnl.AddView (img, valuex, valuey, 30dip, 30dip)
img.Tag =n
valuex=valuex+35
‘Second line of images
If n=9 then
Valuex=7 : valuey=40
End if
Next
this is the second way using a list
B4X:
For j=0 To servizi.Length -1
Dim img As ImageView
img.Initialize ("img")
img.Bitmap =LoadBitmap(File.DirAssets ,servizi(j) &".png") 'Error when load second image
ImgList.Add (img)
Next
I hope that the solution is not the type
B4X:
Dim img1 as ImageView
Dim img2 as ImageView
……
…..
…..
Dim img20 as Imageview
I forgot to say that all the images are loaded into serving designer of Activity