android / architecture-components-samples

Samples for Android Architecture Components.
https://d.android.com/arch
Apache License 2.0
23.42k stars 8.29k forks source link

NetworkBoundResource - data from multiple APIs #338

Open qbait opened 6 years ago

qbait commented 6 years ago

I have one model in my database called Country. To have all information, I need to call 4 APIs (to get general info, to get currency exchange, to get a flag and to get a photo URL). I'm thinking what's the best to modify NetworkBoundResource in this case? Shall I have one NetworkBoundResource for loadCountry() and modify createCall to do multiple calls. Or shall I create 4 different NetworkBoundResource's for every API?

Both approaches don't seem right to me though. What do you reckon?

NapStudio commented 4 years ago

@qbait Hi, which approach did you finally use?