How to save the results from two different APIs to one Room database table?

Viewed 46

The solution method came to my mind. I could display the data in a single recyclerview using MergeAdapter however I could do this with two different database tables.

1 Answers

Make three models the first one for the first API response, the second one for the second API response and the third one is the room entity model, and make functions that convert the first API model and the second API model to the room entity model. Now when you receive the data from APIs convert it to room model and save it to room database.

Related