GridLayout + CardView and Open New Activity Item Click

Android Kotlin gridlayout with cardview and OnItemClickListener. The gridlayout will contain image and text. When item in the gridlayout is clicked a new activity will open and display the image of clicked item.

What we are going to learn in this tutorial is:

How to add grid layout: The grid layout has two important property one is rowCount which helps to determine the number of rows then columnCount help to determine the number of columns.

Creating grid layout item: Our grid layout item will be hosted by cardview that will contain ImageView and Text.

Listening to grid item clicked: We an item in the grid layout is clicked we are going to open a new activity. Opening new activity depends on clicked item.

The tutorial is purely on kotlin.

For additional help, Comment below.

For source code, you can get it with only $5 which help me continue with this work.


One Comment