Android Custom ListView that Open New Activity to Display Clicked Item

In this tutorial we shall learn how to create android custom listview that Open new activity to display clicked item. Our ListView will have Image,Text and OnItemClickListener to listen when an item is clicked then open another activity and display clicked items. The list will consist of images and names of various fruits, When a list item is clicked another activity opens and display both image and name of the clicked item as shown below.

Android ListView  OnItemClick Open New Activity With Clicked Item


    • You can also see in the embedded video below how to start new activity when ListView items are clicked.

    • Let’s get started with coding.

Creating a new android studio project

    • Open your android studio click File => New Project and give it a name in this tutorial i named it listviewnewactivity.
    • Click next select Empty activity => finish.

Adding ListView to our Activity

  • Open activity_main.xml file add listview
  • Preview of activity_main file

Android ListView

Downloading Fruit image

  • Use the link below to download fruit images used used in this tutorial

download images

Creating Resource Layout File for holding listview data

  • Right click layout => New => Layout Resource File and name it row_data.
  • Preview of row_data file show below.

row data file

Creating activity to receive and display clicked item

  • Right click on Layout => New => Activity => Empty Activity => name it in this case i have named it activity_listdata

open your activity_listdata, Copy and Paste the code below.

Receiving and displaying clicked items

  • We are going to use intents to send and receive clicked item.
  • To send data between activities through intent we use
  • To receive through intent we use

Open your ListdataActivity, Copy and Paste the code below for receiving and displaying clicked item.

Initializing ListView and Setting ListView Data

  • Open your class
  • We shall start with initializing our listview and then set data list view data.
  • To set list view data we need to create custom Adapter that extends base Adapter.

Copy and Paste the code below in your

Running our app

  • Run your app and you will see the output below.

Android ListView  OnItemClick Open New Activity With Clicked Item

  • Click on one of the item and you will see another activity with name and image of clicked item.

Android ListView  OnItemClick Open New Activity With Clicked Item


  • That’s all if you have a question or need help please comment below.