Android Question ASTabMenu - how to remove all tabs?

JeffT

Member
Licensed User
When my activity is initialized, I fill an ASTabMenu with code like this:

For x = 1 To <somevalue>
palbar.AddTab(<parameters>)
Next

But when something important changes, I want a whole new set of tabs.
The view has a .RemoveAt() method, and I suppose I could just .RemoveAt(0) until it goes 'ping', but is there a better way?


There is an .Initialize() method, but that wants a CallBack parameter, and I have no idea what to give it there..
 

Alexander Stolte

Expert
Licensed User
Longtime User
and I suppose I could just .RemoveAt(0) until it goes 'ping', but is there a better way?
B4X:
For i = 0 to ASTabMenu.TabSize -1
ASTabMenu.RemoveAt(0)
Next
would be my approach.

I'm still on vacation this week, but I'll add it to my todo list "RemoveAllTabs"
 
Upvote 0

JeffT

Member
Licensed User
Great - Thank you!

ASTabMenu.TabSize is 'number of Tabs'?
I would not have guessed that.
I thought it was something to do with the size... was expecting ASTabMenu.Tabs.count or ASTabMenu.TabCount :)

I did use that approach, but trapped my potential 'ping' in a try catch..

basically DoWhile until I got an exception, then set a boolean flag to exit the DoWhile.
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
ASTabMenu.TabSize is 'number of Tabs'?
yes
I thought it was something to do with the size... was expecting ASTabMenu.Tabs.count or ASTabMenu.TabCount :)
thats why i write a description on functions like that:
getTabSize As Int
Gets the Number of Tabs

I did use that approach, but trapped my potential 'ping' in a try catch..
what do you mean?
Maybe this is better:
B4X:
Dim tabcount as int = ASTabMenu.TabSize
For i = 0 to tabcount -1
If ASTabMenu.TabSize <> 0 Then
ASTabMenu.RemoveAt(0)
End If
Next
 
Upvote 0
Top