'call a method when tab changed fragment

I build an Android App with 3 Tabs. Now I want to call a method, when I switch between this 3 fragments to update the view of the fragments. But the onResume() method doesn't work for that. Do you have any ideas how to call a method in a fragment, when switching to it ? Thank you.



Solution 1:[1]

If you are using “import android.app.Fragment;”

ExampleFragment fragment = (ExampleFragment) getFragmentManager().findFragmentById(R.id.example_fragment);
fragment.<specific_function_name>(); 

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Priyaank