observe
inline fun <T, L : LiveData<T>> LifecycleOwner.observe(liveData: L, crossinline body: (T) -> Unit = {})
Shorthand function that will observe the liveData using this
as the LifecycleOwner. If the emitted value is not null then body is invoked with it as an argument.
Parameters
liveData
the LiveData to be observed
body
function to be invoked with the emitted value as a parameter