Listview With Image And Text In Android Studio Example

In this example, we will create a simple demo for implement listview with image and text 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.

Download Code for Listview With Image and Text

Implementing Listview With Image And Text In Android

Step 1. Create a new project

Make a new project in the Android Studio.

Step 2. Now download this images

Now put these images in 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. Update activity_main.xml

copy and paste following code

Step 4. Create java class named 

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

Add following source code in it.

Step 6. Finally, update class.

Copy and paste below code in

Now run your project, and yes, it will work like shown in the video.

If you have any questions regarding this tutorial, feel free to ask in comment section.

Related Tutorials

  1. RecyclerView with CardView Android
  2. Android RecyclerView with Button

Kotlin Version

Kotlin version of this tutorial : Android Kotlin Listview Example

ReyclerView can give much more speed and smoothness in the android app.

Hence, it is recommended look at above tutorial at once and learn it to make it in your next app.

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...

4 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 *