Android Question Adding customlistview to tabstrips

davelew1s

Active Member
Licensed User
Longtime User
Is this the best way to add a customlistview's to Tabstrips?
B4X:
Region  Project Attributes
    #ApplicationLabel: B4A Example
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

#AdditionalJar: com.android.support:support-v4

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.

End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.

    Private TabStrip1 As TabStrip
   
    Private clv3 As CustomListView
    Private clv2 As CustomListView
    Private clv1 As CustomListView
    Private clv4 As CustomListView
    Private clv5 As CustomListView
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("Main")
    TabStrip1.LoadLayout("bank1", "BANK 1")
    TabStrip1.LoadLayout("bank2", "BANK 2")
    TabStrip1.LoadLayout("bank3", "BANK 3")
    TabStrip1.LoadLayout("bank4", "BANK 4")
    TabStrip1.LoadLayout("bank5", "BANK 5")
   
    For i = 1 To 10
        clv1.AddTextItem($"Item ${i}"$,"clv1")
        clv2.AddTextItem($"Item ${i}"$,"clv2")
        clv3.AddTextItem($"Item ${i}"$,"clv3")
        clv4.AddTextItem($"Item ${i}"$,"clv4")
        clv5.AddTextItem($"Item ${i}"$,"clv5")      
    Next
   
    clv1.InsertAtTextItem(3,"testing",1234)
    clv3.InsertAtTextItem(6,"testing",1234)
    clv5.InsertAtTextItem(9,"testing",1234)
   
End Sub

Sub TabStrip1_PageSelected (Position As Int)
    Log($"Current BANK: ${Position}"$)
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

I've only add 5 tabs as a sample, later I will need to add 10 or more.
Any suggestions.
 

davelew1s

Active Member
Licensed User
Longtime User
OK Peter thanks for the reply .... I was hoping for something simpler but this works so I'll use it.
Dave.
 
Upvote 0
Top