To understand launch modes, lets first understand

What is Task?

What is back stack?

What is task-Affinity?

Task means stack of activities. Stack basically works on last in first out the concept, so the activity that is at the top of the stack ( which comes last ) will be poped ( out of stack) first. In the Android system, as you start an activity, it goes into a stack . And when you press the back button, this activity is popped from the stack given in the below image.

This stack is called Back Stack here.

Here let's assume…

Let’s see how we can enable live crash reporting on firebase. It’s very straightforward and can be done in a few minutes. First of all, you have to integrate firebase. It can be seen here:

For this, we have to enable Crashlytics for our app.

As you are done with the firebase setup, let’s see how we can enable Crashlytics for our app. Go to Crashlytics under the Quality section (left-hand nav panel) and click on that.

After clicking on crashlytics, you will see the above screen. Now click on Enable Crashlytics . You will be moved to here.

Firstly let's understand What is Firebase?

Firebase is Google’s mobile application development platform that helps you build, improve, and grow your app. See detailed description here

Let’s see how we can integrate it into our own app to get these benefits. Its integration is effortless, and you can do it in 5 minutes.

Just follow these steps:

  1. Sign in to firebase with your google account
  2. Click on Create Project

3. Add your project name (could be anything)

There are a lot of secrets and mysteries in the world. I am sure most people have thought about it. And off cause some of them were successful in doing so—Einstein, Newton, etc. There are a lot of scientists who discovered new things. Here one can say they were exceptional. But is it necessary to have an enormous amount of knowledge to discover something? Is it true?

Well, I will say it's not true. Think about the world that was before any physics, chemistry, or anything you know right now. Then how human evolution started. How the human discovered fire

We often have to wait for the API call to show the results on the app; during this app screen remains blanks. If API is taking too much time,, the user gets confused and frustrated about working of app. There are various ways to solve this problem as we have to show some progress.

Let's assume we are fetching restaurant data from an API and showing it to the user. Like data in below image

As we start fetching data screen is empty until we get a response from API. …

Subjects act as an observer as well as observable. It means you can call onNext(), onComplete(), and onError() on a Subject, and it will, in turn, pass those events downstream toward its Observers.

Let’s discuss what the types of subjects are and how and where to use them.


It’s the simplest form of the subject; there are other subjects that changes its behavior based on their implementation. PublishSubject acts as hot observable. If you don’t know what is hot and cold observable, you can read the following post.

Let’s see how we can create a publish subject. …

If you came to this page, I am expecting you to know about observables. If you want to have a look at observables, you can see my previous post here:

Now let’s understand hot and cold observables:

Cold Observable :

Cold Observables are much like a music CD. As you know, a music CD can be replayed to each listener so that each person can hear all the tracks at any time. Similarly, cold Observables will emit the same emissions to each observer, ensuring that all Observers get all the data. Most data-driven Observables are cold, and this includes the…

For a min, don’t think about Rxjava. If, in general, I ask you what is observable, what would you say? Lets search on google

According to google:


Let’s create a status activity like WhatsApp using RxJava.

First of all, I will create some extension functions that I am going to use in this post later.

fun ImageView.loadImage(imageUrl:String) {
val req = Glide.with(this)
fun {
if (this.visibility != View.VISIBLE)
this.visibility = View.VISIBLE
fun View.gone() {
if (this.visibility != View.GONE)
this.visibility = View.GONE
fun Context.getScreenWidth(): Int {
val metrics = this.resources.displayMetrics
return metrics.widthPixels
fun Context.convertDpToPixel(dp: Float): Float {
val resources = this.resources
val metrics = resources.displayMetrics
return dp * (metrics.densityDpi / 160f)

Now let’s create XML for the activity whatsapp_status_activity. We…

Sometimes we need to merge two or more observable emitting the same type of items T. In RxJava, we have some operator to do so.

Let’s see how we can do that:


merge() operator can merge 2 to 4 observable sources of the same type T.

val observableSource1 : Observable<String> =  Observable.just("1", "2")val observableSource2  : Observable<String> =  Observable.just("3", "4")val observableSource3  : Observable<String> =  Observable.just("5", "6")val observableSource4  : Observable<String> =  Observable.just("7", "8")val observableSource5 : Observable<String> =  Observable.just("9", "10")

let’s merge the first two with merge() operator:

Observable.merge(observableSource1, observableSource2)
.subscribe {item->
Log.d(TAG, "received string : $item")


Gaurav Rajput

Working remotely as Android Developer

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