Skip to content

Instantly share code, notes, and snippets.

@gastsail
Last active December 21, 2019 15:10
Show Gist options
  • Save gastsail/4b7dd0419952c0f2d0eaf6c1b19899cb to your computer and use it in GitHub Desktop.
Save gastsail/4b7dd0419952c0f2d0eaf6c1b19899cb to your computer and use it in GitHub Desktop.
fun getEventsDB(): LiveData<MutableList<Event>>{
val data = MutableLiveData<Mutablelist<Event>>()
val myList = mutableListOf<Event>()
FirebaseFirestore.getInstance()
.collection("events")
.get().addOnSuccessListener {
// Get results
myList.add(results)
data.value = myList
}.addOnFailureListener{
// Handle exceptions
}
return data
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment