Hello. I have a question regarding ViewPager.
Consider the following situation:
There is a ViewPager containing 3 fragments. [A, B, C]
Normally, when I instantiate ViewPager, the lifecycle methods of the first fragment and second fragment is called.
In my case, I am fetching data from the network in Fragment’s onStart method so by default both fragments are fetching data from the network at the same time.
How can we prevent this behavior?
I want to know if the following behavior is possible or not?
When I go to fragment A -> it should call network API
When I swipe to fragment B -> it should call network API
and when I move to fragment C -> it should call network API.
Is this possible to achieve?