I have an application with tabs. I use ViewPager and TabLayout. In each tab I have a Fragment. When the tab is unselected I want to call a method from the fragment in that tab. If I want to call method on selected fragment i will do: based on the How to know Fragment id for the fragment(s) provided by