How to Populate Multiple Object Database with Room and LiveData Android

174 Views Asked by At

At cloud DB (firebase or Retrofit doesn't matter.),I have multiple objects like Restaurant, menu, food, user etc. With the first initiation of App,one by one, I need the fetch them all and populate Database. I can fetch any of them alone. I saw Mediatorlivedata,List>> with two object but it doesn't seem practical. There will be many data to insert and many task that bind to. What is the best practice to fit here? What is your suggestion?

Example Objects

public class Restaurant{public String id; public String name;}
public class User{public String id; public String name;}
public class Food{public String id; public String name;}

Remote Repository

LiveData<List<Restaurant>> getRestaurant();
LiveData<List<User>> getUser();
LiveData<List<Food>> getRestaurant();

insert methods to Local are void.

0

There are 0 best solutions below