I create tabs dynamically in a TabActivity. Is there a simple way to ask for the number of existing Tabs?
Maybe a bit of a workaround, but you should be able to use: getTabHost().getTabWidget().getTabCount()
.
I just tested this in my app and it worked correctly.
See here for more info: http://developer.android.com/reference/android/widget/TabWidget.html#getTabCount()
TabLayout tabLayout = findViewById(R.id.tabs);
int totalTabs = tabLayout.getTabCount();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With