Answer the question
In order to leave comments, you need to log in
How to organize work with Room in Android?
Hello. Faced a problem.
There is an Operation entity, I store it in the database.
There is an Account entity to which the operations belong, that is, One2Many, I store the Account identifier in the Operation.
Same story with Category. I store its identifier in Operation.
There is a screen of all operations, that is, displaying them in a list.
In each line of the list of operations, in a good way, I want to display its category and account.
The simplest thing to do.
1. Get all transactions.
2. For each get account and operation category.
A little less clumsy.
1. Get all transactions.
2. Get all categories and put in a Map.
3. Same with accounts.
4. Drag from Map while filling cells.
I am writing a small project on architectural components and MVVM to gain experience, which, apparently, I do not have much.
I use ViewModel and LiveData.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question