Skip to content

Fragment Navigation Support

If you are using multiple Fragments in the same Activity in your application please add this line during any Fragment change:

1
Pointzi.INSTANCE.onTabChanged(getActivity())

Examples

Java

1
2
3
4
5
6
7
tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
            @Override
            public void onTabSelected(TabLayout.Tab tab) {
                Pointzi.INSTANCE.onTabChanged(activity);
                viewPager.setCurrentItem(tab.getPosition());
            }
        });

Kotlin

1
2
3
4
5
6
7
tabLayout.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener {
            override fun onTabSelected(tab: TabLayout.Tab?) {
                Pointzi.INSTANCE.onTabChanged(activity)
                if (tab != null)
                    viewPager.currentItem = tab.position
            }
        })