Android Question MSDynamicGridView with viewpager

apty

Active Member
Licensed User
Longtime User
I am trying to programmaticaaly create grids and load them in a viewpager (https://www.b4x.com/android/forum/threads/viewpager-cleaned-up-viewpager.75342/)

I have created the grids as shown below
B4X:
For k = 0 To dynamicgrid2.Length - 1

        dynamicgrid2(k).Initialize("DGK")
    DynamicAdapter2(k).Initialize("DAK",NumCols, 90%x/NumCols, 100%x/NumCols)
-----

The grids are created. How do i get the current grid in the below event (i.e grid at position k). The sub below only returns the event for one grid but i have 4 grids.

B4X:
Sub DAK_GetContent(Position As Int, ItemID As Long, ItemTag As String, ContentPanel As Panel) As Panel
'    Log("Pos: " & Position & " ItemID: " & ItemID & " ItemTag: " & ItemTag)
   
    Dim lbl2 As Label= ContentPanel.GetView(1)
    lbl2.Text=ItemTag
    lbl2.textColor = Colors.White
   
    Return ContentPanel
   
End Sub
 
Top