All Blogs

Advantage of using const in Kotlin

Advantage of using const in Kotlin

The advantage of using const in Kotlin is that the value gets inlined at compile time, so there is no overhead to access that variable at runtime.

How does the Android Image Loading library solve the slow loading issue?

How does the Android Image Loading library solve the slow loading issue?

Android Image Loading libraries like Glide solve slow loading by following the lifecycle and canceling the tasks for images that are no longer visible.

partition - filtering function in Kotlin

partition - filtering function in Kotlin

partition is a Kotlin filtering function that splits a collection into two lists, one with the elements that match the predicate and one with those that do not.

Why does an Android App lag?

Why does an Android App lag?

An Android App lags mainly because the Garbage Collector (GC) runs very frequently, and while GC is running, the actual app is not running.

HTTP Request vs HTTP Long-Polling vs WebSocket vs Server-Sent Events

HTTP Request vs HTTP Long-Polling vs WebSocket vs Server-Sent Events

HTTP Request asks once, Long-Polling waits until data is ready, WebSocket keeps a two-way connection open, and SSE lets only the server push data to the client.

AssociateBy - List to Map in Kotlin

AssociateBy - List to Map in Kotlin

associateBy is a Kotlin collection function that converts a list into a map, where we decide the key for each item. We will learn it with an example.

Remove duplicates from an array in Kotlin

Remove duplicates from an array in Kotlin

We can remove duplicates from an array in Kotlin using distinct(), toSet(), toMutableSet(), or toHashSet(). We choose one based on our use case.

Caching with OkHttp Interceptor and Retrofit

Caching with OkHttp Interceptor and Retrofit

With OkHttp Interceptor and Retrofit, we can cache HTTP responses in Android, even when the server does not send the Cache-Control header, to build offline-first apps.

Why is it recommended to use only the default constructor to create a Fragment?

Why is it recommended to use only the default constructor to create a Fragment?

We must use only the default constructor for a Fragment because Android calls the no-argument constructor when it recreates the Fragment, like on rotation.