During mobile Apps development, it’s a good practice to save images in the cache for next time fast loading. Most of the time we use Image caching libraries like Fresco, Picasso, or Glide for caching when we load images from a remote URL. But we can also use Android’s native LruChache class for this purpose. […]
How to Save and load Image from Cache Using LruCache in Kotlin Android
It’s a common requirement when we have to save our Images/Bitmaps into the cache in Android. For this purpose, we can use LruCache. Although most of the time while loading images from the server, we use some third party image caching libraries like Picasso, Glide, or Fresco. But if the image is not coming from […]
Method to Remove Consecutive Characters from a String in Kotlin Android
Recently I can across to the problem when I have to remove consecutive characters from a String in Kotlin. My requirement was to allow a maximum of 2 same characters. For this purpose, I have written a generic method to Remove extra same repeating and duplicate Characters from a String in Kotlin. Following is the […]
Game Object Zigzag Movement from Top to bottom in Unity
I have seen in Unity forums that few people are struggling to get the zigzag movement of the game objects in unity. Using the following C# script you can achieve your Game object’s zigzag movement from top to bottom in unity. So, just attach this script to your game object and get the zigzag movement. […]
How to Show Vertical List in Kotlin using RecyclerView Example
As you know we can use RecyclerView in Android to populate long lists. Using RecyclerView we cannot only populate vertical lists. But we can also populate Grid & horizontal lists. In this article, we will discuss how you can show vertical list in Kotlin using RecyclerView. By following the code explained in the article, you […]
How to Get App Version Name in Kotlin Android
Sometimes we have to get the current App version in Android to send it to our server or to show App update popup. You can use the following method to get the App Version Name in Kotlin Android. fun GetAppVersion(context: Context): String { var version = “” try { val pInfo = context.packageManager.getPackageInfo(context.packageName, 0) version […]
AlertDialog with Custom XML Layout in Kotlin Android
We use AlertDialog class to show popups in Android. But sometimes default AlertDialog’s layout is not enough to fulfill our requirement. So that we have to create Alert Dialog with custom layout. This article explains how to create AlertDialog with Custom XML Layout in Kotlin Android. Basic Kotlin Code to populate Custom XML Layout in […]
Inflate Layout at Runtime in Kotlin Android
In this article, you will learn how to inflate one layout in another at Runtime using Kotlin in Android. To populate very few items, we can embed or inflate them on runtime. But for a long list, its always better to use RecyclerView. Following is the basic code to inflate one layout in another in […]
Rounded Rectangle with/without Background & Gradient XML in Android
While designing Android layouts we have to make custom XML based designs. In this article, I am going to share 3 types of XML layouts which will help you to drawable rounded rectangles in your Android Apps, and you can use them as a drawable anywhere in your project. Following are the XML code to […]
How to Embed one XML Layout in Another in Android
It’s a common requirement when we have to make one layout and need to use it on multiple screens. Using include tag we can embed one XML layout in another in Android. In the following example its shown how you can include one layout in another. Include XML Layout <include android:layout_width=”match_parent” android:layout_height=”wrap_content” layout=”@layout/layout_to_include” /> Example […]