Skip to content

Instantly share code, notes, and snippets.

@gastsail
Created December 21, 2019 15:26
Show Gist options
  • Save gastsail/21b281edbb090b97f2580a66827c4a41 to your computer and use it in GitHub Desktop.
Save gastsail/21b281edbb090b97f2580a66827c4a41 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
FirebaseFirestore.getInstance().collection(id).get().addOnSuccessListener {
...
}.addOnFailureListener{
...
}
}.addOnFailureListener{
// Handle exceptions
}
return data
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment