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

The app structure

We are not using any MVC, MVP, or MVVM paradigms because that is not the purpose of this book, so our Activity class will contain all the logic we need to create and show our list of users.

Creating the Activity class

We will set up SwipeRefreshLayout and RecyclerView in our onCreate() method; we have a refreshList() method to handle the fetching and showing of our list of users and showRefreshing() to manage the ProgressBar and RecyclerView visibility.

Our refreshList() function looks like this:

private void refreshList() {
    showRefresh(true);
    mSeApiManager.getMostPopularSOusers(10)
            .subscribe(users -> {
                showRefresh(false);
                mAdapter.updateUsers(users);
            }, error -> {
                App.L.error(error.toString());
                showRefresh(false);
            });
}

We show ...

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