Reactive Programming with RxAndroid in Kotlin: An Introduction

Reactive Programming with RxAndroid in Kotlin: An Introduction

Update note: This tutorial has been updated to Kotlin, Android 26 (Oreo), and Android Studio 3.0 Beta 5 by Irina Galata. The original tutorial was written by Artem Kholodnyi.

[…]

Reactive programming is not just another API. It’s a whole new paradigm and a very useful one. RxJava is a reactive implementation used on Android. Android is a perfect place to start your exploration of the reactive world. It’s made even easier with RxAndroid, a library that wraps asynchronous UI events to be more RxJava like.

[…]

Note: This tutorial requires good knowledge of Android and Kotlin. To get up to speed, check out our Android Development Tutorials first and return to this tutorial when you’re ready.

In this RxAndroid tutorial you will learn how to do the following:

[…]

Build and run the project on your Android device or emulator. You should see a gloriously empty search screen:

[…]

As you probably know, it’s possible to use Java libraries in Kotlin projects thanks to Kotlin’s language compatibility with Java. If that’s the case, then why was RxKotlin created in the first place? RxKotlin is a Kotlin wrapper around RxJava, which also provides plenty of quite useful extension functions. Effectively, RxKotlin makes working with RxJava more Kotlin-y.

[…]

You’ve imported the correct Observable class and you’re using the Kotlin Android Extensions to get references to view objects.

[…]

You might also notice the following line in Android Monitor:

[…]