Search code examples
androidandroid-viewpagerretrofit2call

Retrofit2 calls for viewpager


I have created a viewpager with 2 fragments (fragmentA et fragmentB). For each fragment, I have to call a specific service with retrofit2 to get some datas. For example, for the fragmentA I want to get data about film and for the fragmentB information about TV shows.

To do that, I call service1 in the oncreateView in fragmentA and service2 in the oncreateView in fragmentB. When I launch my app, no problem for the fragmentA I receive all the film but my fragmentB is empty.

Have you an answer about this issue? Maybe it's a cache issue or maybe I have to call service1 and service 2 in the activity that contains the viewpager?

I hope, it's ok for my explanations


Solution

  • In fact, the problem was not the dual call but the response of my api. SO I directly manipulate the api code in Symfony and now it' ok. Thanks for your advise.