RxJava is a very popular library for Android development, and there are a lot of other libraries that are based on RxJava, such as RxAndroid and RxBinding.
This section will cover the following topics:
- The RxAndroid library
- The RxBinding library
RxJava is a very popular library for Android development, and there are a lot of other libraries that are based on RxJava, such as RxAndroid and RxBinding.
This section will cover the following topics:
The RxAndroid library provides a scheduler that uses the main thread. The following example code shows how to use this scheduler:
Flowable.fromIterable(listOf(1, 2, 3))
.subscribeOn(Schedulers.computation())
.observeOn(AndroidSchedulers.mainThread())
.subscribe { println(it) }
The preceding snippet shows how to use the observeOn method to handle emitted values on the main thread.