I'm using TabLayout from Android Design Library. I have multiple tabs and each Tab has an action when it is selected. So I have an attribute startSelection, which performs
tabLayout.getTabAt(startSelection).select();
This selects the tab and performs the action for this tab. It works fine for each Tab except the first one, which is automatically selected on Startup without (!) performing the action. Does anyone have a solution for this?
I don't want to use the onTabReselected method, because this causes another behaviour of the TabLayout. Also selecting the second tab and selecting the first tab afterwards is no good solution.
Best regards
setOnTabSelectedListener
is deprecated. UseaddOnTabSelectedListener
instead. – Paintbox