Android Question TabStrip know empty index tab

scsjc

Well-Known Member
Licensed User
Longtime User
I use this part of class "TabStripViewPagerExtendet" to instert and delete pages :

B4X:
Public Sub InsertPage (tabstrip As TabStrip, Index As Int, Page As Panel, Title As String)
    Dim jo As JavaObject = tabstrip
    jo.GetFieldJO("pages").RunMethod("add", Array(Index, Page))
    jo.GetFieldJO("titles").RunMethod("add", Array(Index, Title))
    RefreshTabStrip(tabstrip)
End Sub
Public Sub RemovePage (tabstrip As TabStrip, Index As Int) As Panel
   If tabstrip.CurrentPage >= Index Then tabstrip.ScrollTo(0, False)
   Dim jo As JavaObject = tabstrip
   Dim p As Panel = jo.GetFieldJO("pages").RunMethod("remove", Array(Index))
   jo.GetFieldJO("titles").RunMethod("remove", Array(Index))
   RefreshTabStrip (tabstrip)
   Return p
End Sub

i use a map to know pages deletes and insert pages using a empty index.
but is possible know a empty index positions ????
 

scsjc

Well-Known Member
Licensed User
Longtime User
I never worked with this class. Are you sure that the indices are not being updated automatically after you remove a tab?

Yes, im try it

1 -when you delete a tab, the index is empty...
2 -can add a new pages to end without errors... ( i pickup the size tab geting a list.size from a "GetAllTabLabels(tabstrip)")
or can "RE-USE" old index to add (i tryit with a MAP, and respect the old position)
 
Upvote 0
Top