Listview With Image And Text In Android Studio Example

In this example, we will create a simple demo for implement listview with image and name of the image.

Listview is used when you want to display multiple items which have a dynamic number of items.Watch this video to have a brief idea about the output of this tutorial.

Implementing Listview With Image And Text In Android

If you are using adblocker, then you will not be able to show our site smoothly. For example, you find step 6 after step 1 or similar to this. So please disable adblocker to fully utilize all resources of DemoNuts

Try Our App

Download DemoNuts app to learn anytime, anywhere: Click to get Demonuts App

Or search “demonuts” in play store from android mobile device.

Step 1. Create a new project in the Android Studio.

Step 2. Now download this images and copy them to the drawable folder.

You can learn how to add items to the drawable folder here in step 2. (No need to create xml file in drawable, just copy and paste images in drawable).

Step 3. In activity_main.xml , copy and paste following:

Step 4. Create one java class named and copy following code in it.

While developing listview, we need to create adapter class in which we can define code for each cell of listview.

We need to create one layout resource file(lv_item.xml here in our example, you can name it as you like) in the resource folder.

This file will contain components like TextView,ImageView, etc. as per requirement.

This file represents a single cell of the listview. In our example it contains one ImageView and one TextView.

In getView() method, lv_item.xml is inflated, and all the components of lv_item can be set here for each cell of listview as per requirement.

Code for lv_item.xml is like:

Step 5. Create a class named and copy following code in it.

Step 6. Finally, copy and paste following code in class.

Now run your project, and yes, it will work like shown in the video, a listview is ready with Image and its name.

You can download the whole source code for this tutorial by clicking on a below button.

Download Demo

Get great search result

Click to get Important Google searching tips


Hardik Parsania

I am mobile app developer. I am always passionate about solving complex and real world problems.I have developed many apps with great interest and superior logical skills.

You may also like...

3 Responses

  1. george says:

    I go to app>java>comp……>new>java class and named “CustomAdapter”
    copy and paste to it.
    I get an error “CustomeAdapter is public, should be declared in the filename “”

    if I remove the word “public” and make local, no error but crash when I run it

  2. shiva says:

    Caused by: java.lang.NullPointerException: Attempt to invoke virtual method ‘void android.widget.ListView.setAdapter(android.widget.ListAdapter)’ on a null object reference

    Add the below line:
    ListView lv=(ListView) findViewById(;

Leave a Reply

Your email address will not be published. Required fields are marked *