OnClickListener

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 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