I have a listview with custom BaseAdapter and each row contains a checkbox and three textviews. I am using Layoutinflater to inflate this row from a xml file. However, every
the problem is definitely within your getView() method;
Try something like this
public View getView(int position, View convertView, ViewGroup parent) {
View vu = convertView;
ViewHolder vHolder = null;
try {
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
if (vu == null) {
vu = (View) inflater.inflate(R.layout.list_fr_req, null);
vHolder = new ViewHolder();
vHolder.checkbox = (CheckBox) vu.findViewById(R.id.my_ChkBox);
vu.setTag(vHolder);
} else {
vHolder = (ViewHolder) vu.getTag();
}
vHolder.checkbox.setOnCheckedChangeListener(this);
vHolder.checkbox.setId(position);
vHolder.textView.setId(position);
if (myList.get(position).getCheckedStatus())
vHolder.checkbox.setChecked(true);
else
vHolder.checkbox.setChecked(false);
} catch (Exception e) {
Log.d("Exception in getview", e + "");
e.printStackTrace();
}
return vu;
}
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
list.get(buttonView.getId()).setCheckedStatus(true);
} else {
list.get(buttonView.getId()).setCheckedStatus(false);
}
}
public static class ViewHolder {
CheckBox checkbox;
TextView textview;
}
Regards: N_JOY.