Hi all
Dabbled with VB over the years, and having a bash with B4A which I thought I was getting my head around until this weekend.
I have been building a flashcard program using betterslidingpanels to retrieve my images.
I inserted
panels(i).SetBackgroundImage(LoadBitmap(File.DirAssets,"Img"&i&".jpg")) as below
Dim panels(21) As Panel
For i = 0 To panels.Length - 1
panels(i).Initialize("panels")
panels(i).Color = Colors.RGB(Rnd(0, 255), Rnd(0, 255), Rnd(0, 255))
Dim lbl As Label
lbl.Initialize("")
lbl.Text = "I'm Panel: " & i
lbl.TextSize = 20
lbl.TextColor = Colors.White
panels(i).AddView(lbl, 20%x, 40%y, 60%x, 30dip)
Activity.AddView(panels(i), 100%x, 0, 100%x, 100%y - 0dip) 'add the panel to the layout
Activity.AddMenuItem("Panel #" & i, "Menu")
panels(i).SetBackgroundImage(LoadBitmap(File.DirAssets,"Img"&i&".jpg"))
Next
This worked well until my images exceeded 10 of 20 now it compiles OK but wont load on my Nexus 7.
So my question is
Am I physically loading all the images into memory by using the above solution, although I did reduce the image size with the same result.
my thought was also, is the "Img"&i& causing an issue as it crashes when i = 2 digits.
I managed to get it to work by loading the images within the animation1_AnimationEnd sub, but the images load to slowly
or am I going completely the wrong way about loading images into panels.
Any responses will be greatly received.
Dabbled with VB over the years, and having a bash with B4A which I thought I was getting my head around until this weekend.
I have been building a flashcard program using betterslidingpanels to retrieve my images.
I inserted
panels(i).SetBackgroundImage(LoadBitmap(File.DirAssets,"Img"&i&".jpg")) as below
Dim panels(21) As Panel
For i = 0 To panels.Length - 1
panels(i).Initialize("panels")
panels(i).Color = Colors.RGB(Rnd(0, 255), Rnd(0, 255), Rnd(0, 255))
Dim lbl As Label
lbl.Initialize("")
lbl.Text = "I'm Panel: " & i
lbl.TextSize = 20
lbl.TextColor = Colors.White
panels(i).AddView(lbl, 20%x, 40%y, 60%x, 30dip)
Activity.AddView(panels(i), 100%x, 0, 100%x, 100%y - 0dip) 'add the panel to the layout
Activity.AddMenuItem("Panel #" & i, "Menu")
panels(i).SetBackgroundImage(LoadBitmap(File.DirAssets,"Img"&i&".jpg"))
Next
This worked well until my images exceeded 10 of 20 now it compiles OK but wont load on my Nexus 7.
So my question is
Am I physically loading all the images into memory by using the above solution, although I did reduce the image size with the same result.
my thought was also, is the "Img"&i& causing an issue as it crashes when i = 2 digits.
I managed to get it to work by loading the images within the animation1_AnimationEnd sub, but the images load to slowly
or am I going completely the wrong way about loading images into panels.
Any responses will be greatly received.