checkBox.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
CheckBox cBox = (CheckBox) v;
if (cBox.isChecked()) {
selectedMap.put(position, true);
}
if (!cBox.isChecked()) {
selectedMap.put(position, false);
public void onClick(View v) {
// TODO Auto-generated method stub
CheckBox cBox = (CheckBox) v;
if (cBox.isChecked()) {
selectedMap.put(position, true);
}
if (!cBox.isChecked()) {
selectedMap.put(position, false);
2015-06-19
public void convert(ViewHolder holder, Apple apple, final int position) {
// TODO Auto-generated method stub
holder.setText(R.id.textView1, apple.getName());
CheckBox checkBox = holder.getView(R.id.checkBox1);
boolean selected = selectedMap.get(position);
checkBox.setChecked(selected);
// TODO Auto-generated method stub
holder.setText(R.id.textView1, apple.getName());
CheckBox checkBox = holder.getView(R.id.checkBox1);
boolean selected = selectedMap.get(position);
checkBox.setChecked(selected);
2015-06-19
// TODO Auto-generated constructor stub
selectedMap = new HashMap<Integer, Boolean>();
int size = list.size();
for (int i = 0; i < size; i++) {
selectedMap.put(i, false);
}
}
selectedMap = new HashMap<Integer, Boolean>();
int size = list.size();
for (int i = 0; i < size; i++) {
selectedMap.put(i, false);
}
}
2015-06-19
public class AppleAdapter extends AppAdapter<Apple> {
private List<Integer> mPos = new ArrayList<Integer>();
public HashMap<Integer, Boolean> selectedMap;
public AppleAdapter(List<Apple> list, Context context, int layoutId) {
super(list, context, layoutId);
private List<Integer> mPos = new ArrayList<Integer>();
public HashMap<Integer, Boolean> selectedMap;
public AppleAdapter(List<Apple> list, Context context, int layoutId) {
super(list, context, layoutId);
2015-06-19
http://zeyuan.me/da-zao-tong-yong-adaptergua-yong-yu-listviewgridview/
2015-06-12