addontabselectedlistener android code example
Example: addOnTabSelectedListener java android
private void initListener() {
tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
@Override
public void onTabSelected(TabLayout.Tab tab) {
mSelectedPosition = tabLayout.getSelectedTabPosition();
lazyLoadAdapter.selectedTab(mSelectedPosition);
}
@Override
public void onTabUnselected(TabLayout.Tab tab) {
}
@Override
public void onTabReselected(TabLayout.Tab tab) {
}
});
}