I defined a Adapter which extends BaseAdapter
when I use ListView
to display something.I overrided View getView (int position, View convertView, ViewGroup parent)
method to reuse View component, in the method, I also wrote if(convertView == null) {System.out.println("test");}
block. There are 50 rows data in ListView
and the screen only can display about 20 rows data. when I ran the application, LogCat printed less than 50 rows of "test" though I slided the screen to make sure all data are loaded.But why ? I think it should print 50 rows data. Here is the key code:
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if(convertView == null) {
convertView = inflater.inflate(resource, null);
System.out.println(++count + "convertView == null:" + convertView);
}
}
someone help me please, I am a newbie.... thanks