I created an Tab based application using viewpager and Tablayout. When i click a button new tabs are created with a child fragment.
What I need is to assign differe
You can use the setTag() method of TabLayout.Tab
to use any Object you want as an identifier. You could do this in your setupTabLayout()
method, where you are setting your custom view for each Tab.
For example, to use a String:
tabLayout.getTabAt(i).setTag("tab_" + i);
You can then later check the tag of each tab in your parent fragment with tab.getTag();