-
Notifications
You must be signed in to change notification settings - Fork 0
Subscribing to a observable
Devrath edited this page Dec 28, 2023
·
1 revision
Code
val observableMovieList = listOf( episodeI, episodeII, episodeIII ).toObservable()
observableMovieList.subscribe{
println("Result-> $it")
}output
Result-> The Phantom Menace
Result-> Attack of the Clones
Result-> Revenge of the SithCode
val observableMovieList = listOf( episodeI, episodeII, episodeIII ).toObservable()
observableMovieList.subscribeBy(
onNext = {
println("Result-> $it")
},
onError = {
println("ErrorMessage-> ${it.localizedMessage}")
},
onComplete = {
println("Emissions are complete")
}
) output
Result-> The Phantom Menace
Result-> Attack of the Clones
Result-> Revenge of the Sith
Emissions are complete