Android Fundamentals #12: Intro to RxJava

Android Fundamentals #12: Intro to RxJava

By Android Academy Minsk

Date and time

Monday, December 2, 2019 · 7 - 9pm GMT+3

Location

SPACE

vulica Kastryčnickaja 16/4 Minsk Belarus

Description

In this lecture, we're going to focus on using Reactive Extensions (Rx) in Java to compose and consume sequences of data.

At a glance, the API may look similar to Java 8 Streams, but in fact, it is much more flexible and fluent, making it a powerful programming paradigm.


1) Intro
- Sync, Async Callbacks
- Rx pros/cons
- When to use Rx

2) val disposable = observable.subscribe(observer)
a) Observable (Event stream)
- Definition
- Marble diagram (timeline, event, complete, error)
- Observable.just/empty/never/error/from
b) Observer
- Definition
- onSubscribe, onNext, onError, onComplete
- Contract (onSubscribe, *onNext onError|onComplete)
c) Disposable
- Definition
- Clear resources

3)
val disposable = observable
.filter { ... }
.map { ... }
.subscribeOn(...)
.observeOn(...)
.subscribe(observer)
a) Operators
- Reducing (take/filter)
- Transforming (map, flatMap)
- Aggregating (scan, reduce, count)
- Combining (merge, zip, combineLatest)
- Time shifting (throttleFirst, debounce)
b) Scheduling and threading
- subscribeOn/observeOn
- io, computation, mainThread

4) Example app
- integration into app (build.gradle)
- search query with debounce and loading from server

Additional reading (out of scope of lecture)
- Single, Maybe, Completable, Flowable
- Backpressure
- Subject (Publish, Behavior, Replay)
- Disposable containers (SerialDisposable, CompositeDisposable)
- More operators in each category (TBD)
- Side effects (doOnXXX)
- Advanced error handling (onErrorReturn, retry)
- hot and cold observables
- custom observables and operators (compose, from emitter)
- testing rx



BTW, we create a telegram chat for the discussions!

See you soon!

Android Academy team.

Great thanks to our partners below!




Info partner

Organized by

Sales Ended