This line is wrong. Activity.GetAllViewsRecursive returns all the views not just the tab hosts.
There is no simple way to directly get the tabs titles. You can do something like:
B4X:
Sub AddTab(th As TabHost, Title As String, LayoutFile As String)
Dim titles As List
If th.Tag = "" Then
titles.Initialize
th.Tag = titles
End If
titles = th.Tag
titles.Add(Title)
th.AddTab(Title, LayoutFile)
End Sub
'Now you can get all titles with:
For Each v As View In Activity.GetAllViewsRecursive
If v Is TabHost Then
Dim titles As List = v.Tag
Log(titles)
End If
Next