Hello Droid Guys,
Today , I found a strange issue in android custom listView adapter. I found that
the adapter getview() method 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
http://stackoverflow.com/questions/2618272/custom-listview-adapter-getview-method-being-called-multiple-times-and-in-no-co
Then After I checked my xml file and I found I am using height = wrap_content in listview.
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:layout_marginRight="3dp"
android:padding="5dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_below="@+id/facebook_friend_list_header" >
</ListView>
And when I changed this to fill_parent
android:layout_height="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 :)
Today , I found a strange issue in android custom listView adapter. I found that
the adapter getview() method 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
http://stackoverflow.com/questions/2618272/custom-listview-adapter-getview-method-being-called-multiple-times-and-in-no-co
Then After I checked my xml file and I found I am using height = wrap_content in listview.
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:layout_marginRight="3dp"
android:padding="5dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_below="@+id/facebook_friend_list_header" >
</ListView>
And when I changed this to fill_parent
android:layout_height="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 :)