I have a CustomCursorAdapter to do the nice section headers. I removed all images from the ListView rows but the scrolling is still rather laggy. Anyone knows a way to optimize this? The scrolling on applications like Viber for Contacts is really smooth even for 2000 contacts. Thanks!
public View getView(int position, View convertView, ViewGroup parent) {
final int type = getItemViewType(position);
if (type == TYPE_HEADER) {
if (convertView == null) {
final LayoutInflater inflater = LayoutInflater.from(context);
convertView = inflater.inflate(R.layout.list_header, parent,
false);
}
((TextView) convertView.findViewById(R.id.list_header_title))
.setText((String) getSections()[getSectionForPosition(position)]);
return convertView;
} else {
View v = super.getView(
position
- sectionToOffset
.get(getSectionForPosition(position)) - 1,
convertView, parent);
int contactIdCol = c.getColumnIndex(ContactsContract.CommonDataKinds.Phone.CONTACT_ID);
String contactId_text = c.getString(contactIdCol);
boolean flag = db.isRegistered(contactId_text);
ImageView iv = (ImageView) v.findViewById(R.id.typeImage);
if (flag) {
iv.setImageResource(R.drawable.rocket);
} else {
iv.setMinimumHeight(Config.getIconSize(context));
iv.setMinimumWidth(Config.getIconSize(context));
iv.setImageDrawable(null);
}
ImageView iv1 = (ImageView) v.findViewById(R.id.test);
cl.displayImage(contactId_text, iv1);
return v;
}
}
To further clarify, it's the fast scrolling that is jerky, the normal scroll seems fine.