74
Common usage of RxJava in Android

Rx Java architecture

Embed Size (px)

Citation preview

Common usage of RxJava in Android

RxJava main advantages

• Concurrency

• Requests Managment

• Data flow manipulation

• Error handling

• Cool, trendy, etc

Everything is a stream

Some new Rx objects

Schedulers

• computation

• io

• newThread

• from

• + AndroidSchedulers.mainThread

Subscription

Subject

Can be both Observable and Observer

PublishSubject

PublishSubject

PublishSubject

Result?

ReplaySubject

BehaviourSubject

RxJava Client-server

RxJava main advantages

• Concurrency

• Requests Managment

• Data flow manipulation

• Error handling

• Cool, trendy, etc

RxJava main advantages

• Concurrency

• Requests Managment

• Data flow manipulation

• Error handling

• Cool, trendy, etc

Practice

Solution

But how to handle configuration changes?

Use Rx in conjunction with

• Retain Fragments

• Cached Observables

Subscription

Use Rx in conjunction with

• Retain Fragments

• Cached Observables

• Bind Rx to Lifecycle

• Loaders

• Services

From Dan Lew

With loaders

Singleton

RxJava in Service

Some Reactive Libraries

RxLifecycle from Trello

RxBinding

RxPermissions