Say I have a ListView in android and its adapter is bound to an arraylist holding two elements.
However I find a question that when I start the activity in which the ListView is located,the getView method of the arrayAdapter is called for many times (at least 4 times).However my arraylist only holds 2 elements.And actually only two elements appear on the screen finnaly.
So here is my question:why the getView method is called much more times than it should be?
public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView,
ViewGroup parent) {
View rowView=convertView;
if(rowView==null)
{
Log.d("rowview==null is true", Integer.toString(childPosition));
}
else{
Log.d("rowview==null is false", Integer.toString(childPosition));
}
There are about 4 Log in LogCat .From my point of view ,it should be 2.
Any help is appreciated.