Relative Content

Tag Archive for kotlinandroid-recyclerviewandroid-livedataandroid-viewmodel

Adding items to recycler view with shared data between activity and fragment with view model

enter image description hereI am new to kotlin, I am trying to work on an app that works with an embedded system trough firebase. After I made the communication with a shared view model between the activity and fragment, I tried adding the alarm data to the recycler view. I used the observe function for live data, but everytime I try to add new alarms to the alarm list it seems like the alarm created earlier is replaced by the new one. I expected a new instance for it, but I figured that the elements added to the recycler view are tied in a way to the live data