As we all know from API level 23 (Android 6.0) and above, we need to ask Runtime Permissions in Android App. The following article contains utility methods to ask runtime permission in Kotlin Android. This code also shows an Alert Dialog to the user to allow permissions from App Settings, if the user denies permission […]
Easiest Way to Observe Application Lifecycle Events in Kotlin Android
Are you looking to observe events like OnStart, OnResume, OnPause, OnStop & OnDestroy for your Android Application in Kotlin? This guide shows the easiest way to listen & receive lifecycle events related to your Application. In this tutorial ‘LifecycleObserver‘ interface is used. Using this interface we can easily observe Application Lifecycle Events in Kotlin Android. Following […]
Pick Image From Gallery in Kotlin – Android
This article contains a step by step guide to pick an image from the Gallery in Kotlin Android. Before starting, add the following READ_EXTERNAL_STORAGE permission in your Manifest.xml file above the application tag. You also need to add Runtime permissions for API Level 19 & above. This article will help you to Ask Runtime Permissions […]
Resize Bitmap by Keeping the Same Aspect Ratio in Kotlin – Android
In Android, we use the Bitmap class to store images. Following is a utility method that would help you to resize Bitmap by keeping the same aspect ratio in Kotlin. Following is the Kotlin solution. Those who are looking for the Java solution can visit How to Resize a Bitmap by Keeping the Same Aspect Ratio in […]
Custom Adapter with Multiple View Types for RecyclerView in Kotlin – Android
As we all know that RecyclerView is a UI component to show lists in Android. In this tutorial, you will learn, How to create a Custom RecyclerView Adapter with Multiple View Types in Kotlin Android. Following is the sample RecyclerView Custom Adapter. It includes multiple view types and written in Kotlin. But if you are looking for […]
Ultimate Guide to Migrate Android Project to AndroidX
Google has replaced the Android Support Library with the latest AndroidX Library. AndroidX library provides backward compatibility whenever the new versions of Android are released. In the latest Android Studio v3.5 when we create a new Android project it shows an option either to use new AndroidX artifacts or old Support Libraries. But this guide […]
How to Fetch Current Location through GPS in Kotlin Android – A Utility Class
Following is the utility class to fetch the user’s current location through GPS by asking Runtime Permissions in Kotlin, Android. It also gives you frequent updates through the listener, on changing the device location. Following is the Kotlin solution if you are looking for Java solution you can find here Utility Class to Fetch Current […]