1

I have a ViewPager and used FragmentPagerAdapter, now I have 4 fragments and in every fragment, I need to make an HTTP request, I don't want to hit all the API for 4 fragments at a time instead I require to hit the API only when the respective fragment is the current item visible.

Any suggestion is welcome. Thanks in advance

Jasurbek
  • 2,946
  • 3
  • 20
  • 37
  • You can use 'setUserVisibleHint' method in the Fragment – DAS Jun 15 '19 at 11:52
  • [Refer this](https://stackoverflow.com/questions/10024739/how-to-determine-when-fragment-becomes-visible-in-viewpager) – Maddy Jun 15 '19 at 13:35

0 Answers0