Android RxJava in 5 minutes

Image for post
Image for post
A typical reaction to googling RxJava

These go(o)gles do noffing!

Image for post
Image for post
Do i have to give credit in these?

What you will need

Dependencies

5 more minutes mom!

private val compositeDisposableOnPause = CompositeDisposable()
Image for post
Image for post

Here be dragons

Ultra mega boring explanation

compositeDisposableOnPause.add(
Single.fromCallable {generateString()}
Single.fromCallable {generateString()}
compositeDisposableOnPause.clear()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe { textGenerated -> button.text = textGenerated }

The end?

Image for post
Image for post
wew lad you made it

Android dude @JustEatUK

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store