Hello everyone
I am trying to handle ViewPager (https://www.b4x.com/android/forum/threads/viewpager-cleaned-up-viewpager.75342/) and xCustomListView (https://www.b4x.com/android/forum/t...-cross-platform-customlistview.84501/#content) in a simpler mode as possible but i fallen in trouble.
In my dream i want to have an undefined number of pages in ViewPager and every page should contain a xCustomListView (and every xCustomListView should containt it's items):
Page1 -> xCustomListView1 -> Item1, Item2, Item3
Page2 -> xCustomListView2 -> Item4, Item5
Page3 -> xCustomListView3 -> Item6, Item7, Item8
etc. etc.
I am able to use ViewPager and i am able to use and load items in xCustomListView.
Let's see the following example: since i don't know how many pages a ViewPager is going to hold i don't know how many layout with a xCustomListView i need.
If i use the following approach i can add as many xCustomListView i want but i can't access to xCustomListView from other subroutines for adding items:
So my question: is there a solution for this problem since i don't know how many pages a ViewPager is going to hold?
Thanks in advance
I am trying to handle ViewPager (https://www.b4x.com/android/forum/threads/viewpager-cleaned-up-viewpager.75342/) and xCustomListView (https://www.b4x.com/android/forum/t...-cross-platform-customlistview.84501/#content) in a simpler mode as possible but i fallen in trouble.
In my dream i want to have an undefined number of pages in ViewPager and every page should contain a xCustomListView (and every xCustomListView should containt it's items):
Page1 -> xCustomListView1 -> Item1, Item2, Item3
Page2 -> xCustomListView2 -> Item4, Item5
Page3 -> xCustomListView3 -> Item6, Item7, Item8
etc. etc.
I am able to use ViewPager and i am able to use and load items in xCustomListView.
Let's see the following example: since i don't know how many pages a ViewPager is going to hold i don't know how many layout with a xCustomListView i need.
B4X:
Sub ViewPager_PageCreated (Position As Int, Page As VPage)
If Page.AlreadyCreated = True Then
'Log("Page already created => do nothing")
Else
'Log("New Page => load the layout")
'We load a simple layout file here.
Page.Panel.LoadLayout("LayoutWithThexCustomListView")
End If
End Sub
If i use the following approach i can add as many xCustomListView i want but i can't access to xCustomListView from other subroutines for adding items:
B4X:
Sub ViewPager_PageCreated (Position As Int, Page As VPage)
If Page.AlreadyCreated = True Then
'Log("Page already created => do nothing")
Else
'Log("New Page => load the layout")
'We load a simple layout file here.
Dim xScroll as CustomListView
xScroll.Initialize ("", "something")
Page.Panel.AddView(xScroll, 0, 0, 100%x, 100%y)
End If
End Sub
So my question: is there a solution for this problem since i don't know how many pages a ViewPager is going to hold?
Thanks in advance