Sitemap
AndroidPub

The (retired) Pub(lication) for Android & Tech, focused on Development

Follow publication

Useful Rx Snippets #2

2 min readSep 2, 2018

Just a few random and (probably) useful Rx snippets in kotlin.

Parallel Observables

Start n number of observables together, and get results of all as an array of responses.

Scenario → There are multiple network requests, that can be run independently, but these requests are to be considered as a single operation.

What the output is:

Single Debounce

Create a debounce effect but only for the first n seconds (or milliseconds).

Scenario → There’s a need to add a small delay between the time response is returned and the time it’s displayed on screen. For example, showing a loader for at least 500ms, if the response is retrieved before 500ms, hold it, and if not then immediately show it.

Infinite Stream with error handling

Handle errors and resume an observable in case of any errors.

What it prints out:

Scenario → Login Screen

You can also checkout Useful Rx Snippets #1 for more snippets.

Happy coding!

Medium Logo
Medium Logo

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

AndroidPub
AndroidPub

Published in AndroidPub

The (retired) Pub(lication) for Android & Tech, focused on Development

Ahmed Rizwan
Ahmed Rizwan

Written by Ahmed Rizwan

Web | Android | Senior Software Engineer @QuixelTools

Responses (1)

Write a response