Android Question imageview not showing ?

DOM85

Active Member
Licensed User
Longtime User
Hello,
Maybe someone could see where is my error in this short example.

I made this short app with only 3 images, but in my big app i need 360 images.
In this example, i have no error, but nothing is displayed, only the layout !

Thank you for your help.
B4A app with array of imagview:
Sub Globals
  Private IMAGE(10) As ImageView
  Private N As Int
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("Layout") ' Layout is empty
    For N = 0 To 2
      IMAGE(N).Initialize("")
      ' Images I0.png, I1.png, I2.png
      IMAGE(N).Bitmap = LoadBitmap(File.DirAssets,"I" & N & ".png")
      IMAGE(N).Top = 0
      IMAGE(N).Left = N * 100
      IMAGE(N).width = 50
      IMAGE(N).Height = 50
      IMAGE(N).Visible=True
      IMAGE(N).Enabled = True
      IMAGE(N).Invalidate
    Next
End Sub
 
Last edited:

teddybear

Well-Known Member
Licensed User
Hello,
Maybe someone could see where is my error in this short example.

I made this short app with only 3 images, but in my big app i need 360 images.
In this example, i have no error, but nothing is displayed, only the layout !

Thank you for your help.
B4A app with array of imagview:
Sub Globals
  Private IMAGE(10) As ImageView
  Private N As Int
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("Layout") ' Layout is empty
    For N = 0 To 2
      IMAGE(N).Initialize("")
      ' Images I0.png, I1.png, I2.png
      IMAGE(N).Bitmap = LoadBitmap(File.DirAssets,"I" & N & ".png")      Sol(N).Top = 0
      IMAGE(N).Left = N * 100
      IMAGE(N).width = 50
      IMAGE(N).Height = 50
      IMAGE(N).Visible=True
      IMAGE(N).Enabled = True
      IMAGE(N).Invalidate
    Next
End Sub
You need to do addView for showing.
B4X:
    Activity.AddView(IMAGE(N),IMAGE(N).Left,IMAGE(N).Top,IMAGE(N).width,IMAGE(N).Height)
 
Upvote 0

josejad

Expert
Licensed User
Longtime User
Hi DOM85:

Unless you need to do something different and very specific, don't try to reinvent the wheel

 
Upvote 0

DOM85

Active Member
Licensed User
Longtime User
Hi DOM85:

Unless you need to do something different and very specific, don't try to reinvent the wheel

Thank you Josejad !
 
Upvote 0
Top