@Override
 public View getView(int i, View view, ViewGroup viewGroup) {
   ViewHolder viewHolder = null;
   if (view == null) {
     view = LayoutInflater.from(context).inflate(R.layout.contacts_item, null);
     viewHolder = new ViewHolder();
     viewHolder.name = (TextView) view.findViewById(R.id.name);
     viewHolder.number = (TextView) view.findViewById(R.id.number);
     viewHolder.check = (CheckBox) view.findViewById(R.id.check);
     view.setTag(viewHolder);
   } else viewHolder = (ViewHolder) view.getTag();
   viewHolder.name.setText(list.get(i).getName());
   viewHolder.number.setText(list.get(i).getPhonenumber());
   viewHolder.check.setOnCheckedChangeListener(
       new CompoundButton.OnCheckedChangeListener() {
         @Override
         public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) {
           if (isChecked) {
             mCBFlag.put(i, true);
           } else {
             mCBFlag.put(i, false);
           }
         }
       });
   /*CheckBox监听事件必须放在setChecked之前,否则后果自负*/
   viewHolder.check.setChecked(mCBFlag.get(i));
   Log.d("position:", "i=" + i + ",view=" + view);
   return view;
 }