Skip to content

Tag: android-room

Relations between Room Tables Android

I am developping a chat app. I have two Entities And In MessageDao I want to get Contact phone correponding to the contact_id in MessageItem Answer You have three ways you can do this. 1) You can use a POJO with an @Embedded and an @Relation in which case you return MessageItem’s with the Contact e.g. :- along with an

Merging multiple LiveData sources?

To make it easier to visualize my problem I drew the following: I am using a RoomDatabase, a Repository, a Viewmodel and Livedata. Areas have a 1 to n relationship with Gateways and Gateways a 1 to n relationship with Items. I created both an AreaWithGateways entity and a GatewayWithItems entity. Items can move from a gateway to another, which