Last active
December 21, 2019 15:10
-
-
Save gastsail/4b7dd0419952c0f2d0eaf6c1b19899cb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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