Reputation: 4307
Actually i'm not looking for code but for some suggestion of how can i make something like a parent in RecyclerView.
I mean i have yet a main recyclerView (grey one on the screenshot) where i add items from other recyclerView (not shown on the screen) now i would be able like if i'm pressing on a item from main recyclerView and i press "varianti" it will open an alertDialog where i there is another recyclerView with a lot of item so if i press on one or more of that items that will add that item under the selected item from main recyclerView.
And when obv i delete the item from main recyclerView as "TORTILLA" that have to delet even the parent items from added "VARIANTI"
Here is a screenshot example of what i would to archive
Upvotes: 0
Views: 69
Reputation: 1262
If you have the same List shared across the screens , I guess you can reuse the ViewModel Object .
A Better approach would be to have both views read data from a Live Data Object (Use it with a ViewModel Object). Whenever there is a change , just update RoomDB/Sqllite or any local Android DB . Your Database will be the single source of truth for all your UI .
The RecyclerView could use Databinding directly to read or Update The List of Objects directly
Upvotes: 1