Month: August 2018

  1. Home
  2. chevron_right
  3. 2018
  4. chevron_right
  5. August

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="" 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…