BaseAdapter
has two functions that deal with having rows of different types:
getItemViewType(int position)
and getViewTypeCount()
You can implement these as follows to do what you are looking for:
//Define constants for your different view types
public final int CONTACT_INFO_TYPE = 1;
public final int HEADER_TYPE = 2;
//Return which view type should be shown, based on the position in the list view
@Override
public int getItemViewType(int position) {
if(something) {
return HEADER_TYPE;
} else {
return CONTACT
}
//Return the count of different views shown in the list
@Override
public int getViewTypeCount() {
return 2;
}
//Use getItemViewType(...) to decide what kind of View you should return
@Override
public View getView (int position, View convertView, ViewGroup parent) {
int type = getItemViewType(position);
if(type == CONTACT_INFO_TYPE) {
//Return a view containing contact info
} else {
//Return a view containing header info
}
}