Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the current selected item position using TabLayout in Android Design Library

I am using the android design library TabLayout in that how can I get the current selected item tab position.

  ViewPager pager = (ViewPager) view.findViewById(R.id.pager);      
  MyPagerAdapter adapter = new MyPagerAdapter(getChildFragmentManager());
  pager.setAdapter(adapter);
  tabLayout.setupWithViewPager(pager);
like image 680
Kamalanathan Avatar asked Dec 09 '22 03:12

Kamalanathan


1 Answers

As of version 22.2.1 of the Support library the TabLayout has a method getSelectedTabPosition.

Source 1 | Source 2

like image 151
Niklas Avatar answered Dec 11 '22 11:12

Niklas