Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Main")
hsvPages.Panel.Width = 4 * hsvPages.Width
hsvTimer.Initialize("hsvTimer", 200)
objPages.Target = hsvPages
objPages.SetOnTouchListener("hsvPages_Touch")
Dim bd As BitmapDrawable
bd.Initialize(LoadBitmap(File.DirAssets,"icon.png"))
Dim i As Int
For i = 0 To 3
pnlPages(i).Initialize("")
pnlPages(i).Background = bd
hsvPages.Panel.AddView(pnlPages(i), i * hsvPages.Width, 0, 100%x, 100%y)
Next
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Main")
hsvPages.Panel.Width = 4 * hsvPages.Width
hsvTimer.Initialize("hsvTimer", 200)
objPages.Target = hsvPages
objPages.SetOnTouchListener("hsvPages_Touch")
Dim bd As BitmapDrawable
bd.Initialize(LoadBitmap(File.DirAssets,"icon.png"))
Dim i As Int
For i = 0 To 3
pnlPages(i).Initialize("")
pnlPages(i).Background = bd
hsvPages.Panel.AddView(pnlPages(i), i * hsvPages.Width, 0, 100%x, 100%y)
Next
End Sub
it works but it loads 8 times only 1 image, in the path there are 8 images
B4X:
Activity.LoadLayout("Main")
hsvPages.Panel.Width = 4 * hsvPages.Width
hsvTimer.Initialize("hsvTimer", 200)
objPages.Target = hsvPages
objPages.SetOnTouchListener("hsvPages_Touch")
root=File.DirRootExternal
path1 = root & "/BetaVersion/"
For Each f As String In File.ListFiles(path1)
Dim bd As BitmapDrawable
bd.Initialize(LoadBitmap(path1,f))
Dim i As Int
For i = 0 To 8
pnlPages(i).Initialize("")
pnlPages(i).Background = bd
hsvPages.Panel.AddView(pnlPages(i), i * hsvPages.Width, 0, 100%x, 100%y)
Next
Next
it works but it loads 8 times only 1 image, in the path there are 8 images
B4X:
Activity.LoadLayout("Main")
hsvPages.Panel.Width = 4 * hsvPages.Width
hsvTimer.Initialize("hsvTimer", 200)
objPages.Target = hsvPages
objPages.SetOnTouchListener("hsvPages_Touch")
root=File.DirRootExternal
path1 = root & "/BetaVersion/"
For Each f As String In File.ListFiles(path1)
Dim bd As BitmapDrawable
bd.Initialize(LoadBitmap(path1,f))
Dim i As Int
For i = 0 To 8
pnlPages(i).Initialize("")
pnlPages(i).Background = bd
hsvPages.Panel.AddView(pnlPages(i), i * hsvPages.Width, 0, 100%x, 100%y)
Next
Next
Of course you have to create new bitmap for every background like this
B4X:
Dim path1 As String = File.Combine(File.DirRootExternal,"/BetaVersion/")
Dim files As List = File.ListFiles(path1)
Dim bd As BitmapDrawable
For i = 0 To files.Size - 1
Dim p As Panel : p.Initialize("")
hsvPages.Panel.AddView(p, i * hsvPages.Width, 0, 100%x, 100%y)
bd.Initialize(LoadBitmapSample(path1,files.Get(i),p.Width,p.Height))
p.Background = bd
Next
also I'm not sure for which purpose this app is going to be, but target api 14 and what you are doing with this example pretty much denies you ever sharing this kind of app in PlayStore.
Of course you have to create new bitmap for every background like this
B4X:
Dim path1 As String = File.Combine(File.DirRootExternal,"/BetaVersion/")
Dim files As List = File.ListFiles(path1)
Dim bd As BitmapDrawable
For i = 0 To files.Size - 1
Dim p As Panel : p.Initialize("")
hsvPages.Panel.AddView(p, i * hsvPages.Width, 0, 100%x, 100%y)
bd.Initialize(LoadBitmapSample(path1,files.Get(i),p.Width,p.Height))
p.Background = bd
Next
also I'm not sure for which purpose this app is going to be, but target api 14 and what you are doing with this example pretty much denies you ever sharing this kind of app in PlayStore.