Hi Everyone,
I am implementing my own adapter that inherits from BaseAdapter (this
is something very classic).
Then when I start the activity that owns the listView binded to this
adapter I can see that the getView() method is called more times than
what the number of view actually available in the list.
For instance, I do have 2 rows in my list and when I first set the
adapter getView is called 6 times. Then If I make a call to
notifyDataSetChanged(), getView is called 4 times.
I understand that when you scroll up and down getView must be called
to generate or re use a view but I don't scroll up or down, I am
really wondering why getView is called so many time.
Thanks a lot in advance for your responses.
Jabu
My code just in case even though it is a pretty basic piece of code:
public View getView(int position, View convertView, ViewGroup
parent)
{
ViewHolder holder;
if (convertView == null)
{
convertView = mInflater.inflate(R.layout.row_action,
null);
// Creates a view holder
holder = new ViewHolder();
...
convertView.setTag(holder);
}
else
{
holder = (ViewHolder)convertView.getTag();
}
holder.params.set....
return convertView;
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---