In the last few months we published a ten-part series about RxJava that covered over than 70 operators, including some variants of them, in different scenarios. Now, we decided to wrap all examples together in a single app plus some other examples we found useful. The idea is basically to provide a single app with over than 100 examples of RxJava which you can use as a reference when dealing with RxJava.
Update: This project was entirely convert to Kotlin! Yes, no more Java code in there… Just Kotlin! In case you still want the Java code, clone the JAVA_CODE tag in the GitHub repository.
I made it during my Kotlin learning process, and it was a great opportunity for me to improve my Kotlin skills. Hope you can take advantage of it as well.
Note that since RxJava 1.x version is no longer supported, I decided to start migrating this project to use RxJava 2.x instead. I hope to get it done soon… so, stay tuned on the next updates.
In order to make it easy to find the examples throughout the app, we divided them in different categories. They are:
- Operators Examples: Basically it contains examples of many operators used to filtering, combining, transforming data, dealing with error handling, etc.
- Backpressure Examples: Contain different approaches to deal with backpressure.
- Hot Observable Examples: Show how to use Hot Observables by using operators such as cache, replay, etc.
- Parallelization: Demonstrate how to do real parallelization using RxJava operators and schedulers.
- General Examples: Contain some examples that do not fit in any of the previous categories.
Different from the previous articles, we are not going into the details about any example provided on the demo app. The reason is that either they were already covered into details in one of the articles of our RxJava series (you can find the links below) or they were based on external articles, so you can go directly to those articles and see the the authors’ explanations.
It’s worth mentioning whenever an example was based on an external article, we added a reference to the sources, so all the credits go to the authors.
That being said, you can find below a list of all covered examples on the demo app and the articles on which they were based:
- Operators Examples
- Filtering Operators (12 examples)
- More about Filtering Operators (5 examples)
- Combining Observables (9 examples)
- Conditional Operators (10 examples)
- Transforming Operators (9 examples)
- Timeout Operator (7 examples)
- Mathematical and Aggregate Operators (7 examples)
- Join Operator (1 examples)
- Retry and RetryWhen (6 examples)
- ConcatMap and FlatMap (2 examples)
- Error Handling (5 examples)
- Back Pressure Examples
- Backpressure (8 examples)
- Hot Observable Examples
- Hot Observables` (6 examples)
- General Examples
- Simulate Server Polling (4 examples) – This example is useful when we need to poll a server periodically until it finishes a certain task.
- Server Polling After Local Data Processing (3 examples) – This example is useful when we need to poll a server and process some data locally, and only after finish local processing, poll the server again.
- Typing Indicator (1 example)
- Drawing Example (1 example) – This example shows how to react to mouse events as well as listen for SeekBar and menu item click events by using RxBindings library.
- Broadcast System Status (1 example) – This example shows how to listen for broadcast system messages by using RxBroadcast library.
You can download demo app here (now in Kotlin!).
As mentioned before, the main idea for this article is to wrap in a single app a bunch of RxJava examples. Some of them were previously published on our RxJava ten-part series, and some others were based on some articles I found on the Internet.
I really hope it can be useful, and as usual, if you have any question, please, leave a comment below.
Thanks for your audience! See you on the next article.