Kotlin

In this Kotlin programming tutorial I am going to share with you how to load image from a remote URL in Kotlin using Glide. Glide is probably the easiest and the most efficient way to load image to an ImageView.  You can use Glide to load a local image and well as an image hosted on a remote…

Read More Load Image From a Remote URL with Kotlin and Glide

In this short Kotlin programming tutorial we will learn how to create a Switch in Kotlin programmatically. In the code example below we are going to cover: Create Switch and add it to a LinearLayout Get input from the Switch when it’s state is changed  Set textOff and textOn text programmatically Set OnClickListener on the…

Read More Create a Switch in Kotlin Programmatically

In this short Kotlin programming tutorial I am going to share with you how to create a CheckBox in Kotlin programmatically. You will learn how to create two checkboxes and how to read a value from CheckBox when it is selected. The code example below with cover: Create CheckBox in Kotlin programmatically, Use setOnClickListener to know when check…

Read More Create Checkbox in Kotlin Programmatically

In this short Kotlin tutorial I am going to share with you how to create a TimePicker in Kotlin programmatically and how to update text label when the value of Hours or Minutes has changed. The below code example will cover: Create TimePicker and add it to LinearLayout Get input from TimePicker when user changes the value…

Read More Create TimePicker in Kotlin Programmatically

In this Kotlin code example we will learn how to create DatePicker in Kotlin programmatically. To break it in more details the code example below will cover:  Create DatePicker in LinearLayout Initialize DatePicker with current date( Year, Month and Day) When user changes the DatePicker values, call OnDateChangeListener and get input from the DatePicker Set DatePicker values…

Read More Create DatePicker in Kotlin

In Kotlin you may skip and not use the findViewById( ) and still be able to refer to UI components defined in XML Layout file. There is another way. You will need to do a couple of things first:  Edit your Module/ app level build.gradle file Import the data binding library into the Kotlin file (Don’t worry,…

Read More You may skip and not use the findViewById( ) in Kotlin

In this short code example below we will learn how to create ImageButton in Kotlin programmatically. A short code snippet in Kotlin below will cover: Create ImageView in a ConstraintLayout Load image from a resource Set onClickListener on ImageButton Change ImageButton image when the button is tapped For this example to work and to load an…

Read More Create ImageButton in Kotlin programmatically

In this short Kotlin code example we will learn how to create a single CardView in Kotlin programmatically. CardView is a FrameLayout with a rounded corner background and shadow. You can add multiple views into a CardView and then show them in a list one under another.  We will make a quotation card containing quote and…

Read More Create CardView in Kotlin Programmatically

Below is a very short tutorial on how to create RecyclerView in Kotlin programmatically. RecyclerView is a flexible view for providing a limited window into a large data set and learning how to create and use it make you even better Mobile App Developer :). The Kotlin code example below will cover: Create RecyclerView Create RecyclerAdapter Create a…

Read More Create RecyclerView in Kotlin Programmatically

With this blog post I am going to share with you how to create a ListView in Kotlin programmatically. ListView is a very commonly used UI component and knowing how to work with it enables you build even more powerful apps. The example below will cover: Create ListView in a ConstraintLayout Populate ListView with data using…

Read More Create ListView in Kotlin Programmatically