shrikanth
shrikanth

Reputation: 129

Fetching tab title in viewpager

I have implemented ViewPageIndicator and it is running fine. I have 3 tabs with names "Tab1", "Tab2", and "Tab3". What I want is the tab name when I scroll the tab.

Could anyone let me know how to fetch the tab title of the current tab that is being displayed?

Upvotes: 1

Views: 836

Answers (1)

Joseph Earl
Joseph Earl

Reputation: 23432

You can get the title for the current page from your PagerAdapter:

int currentPage = viewPager.getCurrentItem();
CharSequence pageTitle = pagerAdapter.getPageTitle(currentPage);

Upvotes: 1

Related Questions