I have a TabLayout and inside that I have ViewPager. I need to dynamically add and remove tab in tablayout(material design). I can able to add the tabs dynamically but while
With the new support library (I'm using 23.2.1) you should only add to the Viewpager and not the TabLayout (otherwise you end up with double tabs and other funky behavior). So to update TouchBoarder's answer:
Add a removeTabPage method to your PagerAdapter
public void removeTabPage(int position) {
if (!tabItems.isEmpty() && position
Add a addTabPage method to your PagerAdapter
public void addTabPage(String title) {
tabItems.add(title);
notifyDataSetChanged();
}