O'Reilly logo

RxJava Essentials by Ivan Morgillo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Our first Observable

In our first example, we are going to retrieve the list of the installed apps and populate a RecyclerView item to show them. We also have a fancy pull-to-refresh feature and a progress bar to notify the user that the task is ongoing.

First of all, we create our Observable. We need a function that retrieves the installed apps' list and provides it to the Observer. We are emitting items one by one and then grouping them into one single list, to show the flexibility of the reactive approach:

import com.packtpub.apps.rxjava_essentials.apps.AppInfo; private Observable<AppInfo> getApps() { return Observable.create(subscriber -> { List<AppInfoRich> apps = new ArrayList<>(); final Intent mainIntent = new Intent(Intent.ACTION_MAIN, null); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required