If you are developing Android apps using Kotlin, lazy property is one of the useful features that helps us save some memory by delaying the initialisation until they are requested and keeping that instance for the rest of the usage. However, recently I have encountered a nasty bug, which causes a memory-leak, while using it in fragment. In this article, I will show you the potential bug you might face with lazy property in activity/fragment and how to solve it.
RxJava is a Java implementation of ReactiveExtensions (or ReactiveX) which supports writing programs in asynchronous and event-based style through observable streams. SubscribeOn is one of the most-used operators in Rx so it is important to know how it works. This article assumes that you’re already familiar with basic RxJava’s concepts. Now let’s dive in!
As the official doc has pointed out:
By default, an Observable and the chain of operators that you apply to it will do its work, and will notify its observers, on the same thread on which its
Subscribemethod is called. The SubscribeOn operator changes this…
While working with Recycler View in Android, we usually have to deal with various adapters specifically built for different lists. In someway, this has burdened us with more code to maintain. Therefore, I’ve created a common adapter that, together with data binding, can be used for any data set. This means you only have to create these classes once and reuse them multiple times.
Android Developer @ Maas Global