Hot and Cold Observable: RxJava

val coldObservable : Observable<String> =
Observable.just("1", "2", "3", "4")
.doOnComplete {
Log.e(TAG, "Completed emitting streams")
// First observer
val firstObserver= coldObservable.subscribe {
Log.d(TAG," observer 1 receveied: = $it")
// second Observerval secondObserver= coldObservable.subscribe {
Log.d(TAG," observer 2 receveied: = $it")
//hot observable example
val hotObservable = Observable.interval(1, TimeUnit.SECONDS)
.doOnComplete {
Log.e(TAG, "Completed emitting streams")
val firstObserver = hot.subscribe {
Log.e(TAG," observer 1 receveied: = $it")
Thread.sleep(3000);val secondObserver = hot.subscribe {
Log.e(TAG," observer 2 receveied: = $it")

Working remotely as Android Developer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

What is difference between Arrow Functions and Regular Functions?

arrow functions vs regular functions

Top 5 Frontend Frameworks to Learn in 2022

VS Code Extensions to Boost Your Productivity 3X

Just In Case. Laravel, handling active menu item

The difference between props and state in React

Data Types in JavaScript

Why we should use spread operator. . .

How to Make an Effective Exit-Intent Popup in JavaScript

How to Make an Effective Exit-Intent Popup in JavaScript

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
Gaurav Rajput

Gaurav Rajput

Working remotely as Android Developer

More from Medium

TLDR : REACH Restriction Webinar

Ryan Kavanaugh’s Triller Announces Merge with SeaChange — QuintDaily

Vegetarianism in the Netherlands

Residential composting as a worry about sustainable food.

One trick for native and non-native speakers to properly use who vs. whom.