I have created an app for contact app. i have a problem in my cutom cursor adapter that has a two textview and Image view every time i scroll up and down the images is repeating on the other list item. anyone can help me on this one. thanks in advance.
here's a code
@Override
public void bindView(View view, Context context, Cursor cursor) {
if(view !=null){
ViewHolder holder = initViewHolder(view);
holder.displayName.setText(getUserDisplayName(cursor.getString(userid)));
holder.groupId.setText(cursor.getString(group));
holder.displayPhoto.setImageURI(imageUri);
}
}
private ViewHolder initViewHolder(View view) {
ViewHolder innerViewHolder = null;
if(innerViewHolder == null){
innerViewHolder = new ViewHolder();
innerViewHolder.displayName =(TextView) view.findViewById(R.id.name);
innerViewHolder.groupId = (TextView) view.findViewById(R.id.groupId);
innerViewHolder.displayPhoto = (ImageView) view.findViewById(R.id.photo);
}
return innerViewHolder;
}
class ViewHolder{
TextView displayName;
TextView groupId;
ImageView displayPhoto;
}
@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
return inflater.inflate(R.layout.contact_list_item, null);
}