Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
LiveEvent sample (for snackbar)
/**
* Snackbar LiveEvent
* (see https://github.com/hadilq/LiveEvent)
* This is private because we don't want to expose setting this value to the Fragment.
*/
private val snackBarEvent = LiveEvent<String>()
val showSnackBarEvent: LiveData<String> = snackBarEvent
//https://github.com/hadilq/LiveEvent
implementation "com.github.hadilq.liveevent:liveevent:1.0.1"
sample:
https://github.com/alexshr/andfun-kotlin-sleep-tracker/blob/master/app/src/main/java/com/example/android/trackmysleepquality/sleeptracker/SleepTrackerViewModel.kt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment