Custom ListView Using Baseadapter – Hike and Whatsapp Like ListView

Posted on .

Good morning folks ! Here I am going to show you simple and awesome tutorial on Custom List view using Base adapter with Text and images .This tutorial is going to be awesome because this is the starting of your first chat application like Hike and Whatsapp, how to develop a chat application I’ll provide simple tutorial on it but first lets start with basic need. Lets dig inside-

In this tutorial I have taken three Text View and one Image View for profile pictures. Lets start quickly.

NOTE – If you got error after importing this code then just delete value-11 and value-14 folders and remove extended ActionBarActivity and do it to Activity and import it.

Download Code

Lets do the code , firstly start the code with designing part  that’s my personal point of view that always start with designing part i.e. XML . Many developers also do the same. So take new Android project and name whatever your is and go to your Layout folder and double click activity_main.xml and paste the following code.

In this xml file I have taken a simple ListView that going to show us on launching our application.


After that we should go to strings.xml file in our values folder and take arrays for listview .

Now take another XML file for custom View that you want in your android application . This View is something like if you want to show images,text,radio button,buttons in your list view than you have to take new XML file and you have to make your view which we going to embed in our simple List View.

Here we take list_item.xml for this View and in it I have taken ImageView,TextView .

Now Coding part , In this part I have taken a three java files in our src folder , get started with it. I have taken a Bean class namely .What basically a Bean class is that it is a reusable software component it encapsulate many objects into one and we can access this objects from multiple places , also maintenance become so easy .Its upto you that you want to take this Bean Class or not.

After this make a class in your project under src folder and paste the following code.This class should extends Baseadapter and thus you should implements rest of the override methods .

Steps to be followed

1). Class Should extends Baseadapter and implements overrided methods .

2). Take inner class ViewHolder and declare some TextView and ImageView respectively .

3).  Take LayoutInflator object and ViewHolder object.

4). Write a condition for Views and setImageResources and setText .

Now take file and include the below code there .

 Below hierarchy should be like this –


hierarchy of project

Now Run your project and see your output in the emulator .



custom listview output

For more query and suggestions , do comment below ,love to hear from you . Thank You 😛