@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null){
convertView = ContactViewActivity.this.getLayoutInflater().inflate(R.layout.contact_view_field_row,
parent, false);
}
String value = (String)getItem(position);
TextView fieldValue = (TextView)convertView.findViewById(R.id.contact_view_row_value);
fieldValue.setText(value);
return convertView;
}
The above code is taken from a BaseAdapter class. So what is the point of setting the inflated view to convertView? The whole point of the getView is to make a view if there isn't one, give it attributes, then return it so it can be shown in the application in the ListView right? So why not just say findViewById(R.id.contact_view_row_value);? I mean what are we really doing with the layoutInflater? I'd think that since we set it equal to convertView, there would be no need to type convertView.findViewById. I mean it is already equal to an inflated XML file right? I'm quite confused here, I'd really appreciate some clarification.