1. Home
  2. chevron_right
  3. Kotlin

Kotlin RecyclerView with Click Listener

commentNo Comments
Prerequisites : kotlin_version = ‘1.3.31’ In app – build.gradle: implementation ‘androidx.appcompat:appcompat:1.0.2’implementation ‘androidx.constraintlayout:constraintlayout:1.1.3’ In this post we will write in Kotlin a very simple example for RecylcerView with a click listener. activity_main.xml <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <androidx.recyclerview.widget.RecyclerView android:id="@+id/my_recycler_view"…

Kotlin ListView with ViewHolder

commentNo Comments
In this post we will create a ListView with ViewHolder adapter but we will write the code in Kotlin. For creating xml files for ListView and list items, follow the steps from this post. Next, you have to create a…

Kotlin Common Questions

commentNo Comments
1. Where should we keep constants in Kotlin? if you need constants to be accessed globally use const as top-level properties (not inside a class). In order to do this create a Kotlin file named Constants.kt. The file would look like…

Kotlin – Hello world

commentNo Comments
Introduction What is Kotlin? It is a new programming language built by JetBrains, and as you may already know, Google announced at Google I/O 2017, that they will now officially support this language. It is inspired by existing languages such…