Sunday 21 July 2013

android listview adapter getview() called multiple times

Hello Droid Guys,
Today , I found a strange issue in android custom listView adapter. I found that
the adapter getview() method called multiple times.

adapter getview() called multiple times

On my listview I am showing following Item:
1. User facebook image
2. His|Her Name
3. Some description

As, I told you that getview() method calls multiple time, due to this behavior the Image on
list item some times remain unchanged or same profile picture will be attach on different
user , in listview.
First of all I think that this was an issue of lazy image loader library But I was wronged.
After spent few times on google for searching this issue , I found this link

Then After I checked my xml file and I found I am using height = wrap_content in listview.

         android:layout_below="@+id/facebook_friend_list_header" >

And when I changed this to fill_parent


then all problem is resolved and now the getview() method will be called only once.
Also the user profile picture issue will be resolved.

Android Guys , still I was not cleared about the above tricks. Please let me know why
getview() method called multiple times when I am using
android:layout_height="wrap_content" . If some one know the reason then
please let me know.

Thanks in advance.
Enjoy Coding :)

Mukesh Kumar

Hi Guys I am from Delhi working as Web/Mobile Application Developer(Android Developer), also have knowledge of Roboelctric and Mockito ,android test driven development... Blogging has been my passion and I think blogging is one of the powerful medium to share knowledge and ideas....


  1. my listview height is already match_parent, but i have same problem,too. Do you have any other solution.. ? thanks.

  2. You can find related issue question on StackOverflow -



Copyright @ 2013 Android Developers Blog.