Answer the question
In order to leave comments, you need to log in
How to link the favorites tab and the main one?
Good evening, now I'm working on an application with which you can record and repeat English words. Now I'm implementing the favorites tab.
My application is built on the interaction between fragments in one activity. There are 3 fragments with different types of parts of speech (noun, verb, etc.) the list in the fragment is implemented using RecyclerView.
I linked the main lists and the favorites list by adding to the database, but only the main fragments can manage the favorites list, and it’s impossible to remove an element from the favorites and not knock down the image function (⭐->).
Question: how can I link the list of favorites and main words, so that when deleting from favorites, the picture in the main fragments changes, and vice versa?
Note! I don't need to write code, I want to do it myself. I just need to suggest the implementation or poke my nose into the article.
Answer the question
In order to leave comments, you need to log in
Well, obviously, there must be a repository that sticks out streaming lists. When the database inside is updated, new data should arrive in the stream.
PS stream it in terms of Rx Observable. If you don't use Rx, use alternatives, like listener is the simplest. In flow coroutines.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question