change this..
@Override
public Object getItem(int position) {
return position;
}
to..
@Override
public Object getItem(int position) {
return data.get(position);
}
Update:
try this..
public View getView(final int position, View convertView, ViewGroup parent) {
View view = null;
if (convertView == null) {
LayoutInflater inflator = context.getLayoutInflater();
view = inflator.inflate(R.layout.people_list_item1, null);
holder = new ViewHolder();
holder.title = (TextView) view.findViewById(R.id.tv_name);
holder.image = (ImageView) view.findViewById(R.id.avtaar);
holder.favorite = (CheckBox) view.findViewById(R.id.fav);
holder.favorite.setOnCheckedChangeListener(new OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
//do what you want..
}
});
view.setTag(holder);
} else {
holder = (ViewHolder) view.getTag();
}
holder.favorite.setChecked(data.get(position).isSelected());
holder.title.setText(data.get(position).getName());
try {
holder.image.setImageBitmap(openPhoto(Long.valueOf(id_list.get(position))));
} catch (Exception e) {
e.printStackTrace();
}
return view;
}