RxJava does not include concurrency on its own. Scheduler creates an instance of a worker that is responsible for scheduling and running code. There are 2 main operators that allow users to use scheduler ie. subscribeOn() and observeOn().
We have some builtin schedulers like Scheduler.io(), Scheduler.computation(), Scheduler.newThread() and many more, you can read them from here. In this article mainly we will try to understand observeOn and subscribeOn, also the difference between the two.
Let's start with basic code, without any observeOn or subscribeOn
So we see that everything runs on the same thread. By default, everything in RxJava runs on the same thread. Now let's see what happens when we use various combination of subscribeOn and observeOn. …
AnimatedVectorDrawable was added in Android 21. It provides us with the power of animation by using XML only. It animates the property of vector drawable using object animator or animator set.
Starting from android 25 AnimatedVectorDrawable run on the render thread, this means even if UI thread is doing the heavy lifting animation may be smooth. For API less than 21 AnimatedVectorDrawableCompat can be used.
AnimatedVectorDrawableCompat is defined in XML same as AnimatedVectorDrawable.Let's understand with an example
Basically, we need to define 3 main things
Now, these three can be either in one XML of 3 different XML. …
In this article, we will like to talk about some great lambda functions that kotlin provide us. These function can help us deal with complex data structures making code cleaner and better. As more and more developers are starting to move to kotlin this can also act as a small cheat sheet for them.
One of the great feature kotlin provides us is passing a function as a parameter to other functions or storing function in a variable. Let’s talk about some function that kotlin collection provides us.