Skip to content Skip to sidebar Skip to footer

How To Handle Race Conditions In Kotlin, When Listening To A Firebase Database Node

Today, when I was working on my android project, I saw this weird behavior of my app. When I click on an icon and move to a different activity, which would basically insert another

Solution 1:

Avoid using mutable lists and data classes, but rather just use map on your data to transform it to a read-only List of the type you need for your list view.

Make your RecyclerView.Adapter store a var property so it is changed all at once. Change the data list and call notifyDataSetChanged(). Then it is only ever looking at one list at a time.

Post a Comment for "How To Handle Race Conditions In Kotlin, When Listening To A Firebase Database Node"