0

我有一个ListItem人名e.g. ABCD和一个RadioGroup有两个RadioButtons。在我bindView()单击任何一个时RadioButton,它应该更新名称为ABCD. 但它只更新了我的 ListView 中显示的 lastItem。这是我的 BindView() :

@Override
        public void bindView(View view, Context context, Cursor cursor) {

            holder =  new  Holder();
            holder.stName = (TextView)view.findViewById(R.id.stName);
            holder.stName.setText(cursor.getString(cursor.getColumnIndex(AttendanceContentProvider.STUDENT_NAME)));

            _id_ = cursor.getString(cursor.getColumnIndex(AttendanceContentProvider._ID));
            _name_ = cursor.getString(cursor.getColumnIndex(AttendanceContentProvider.STUDENT_NAME));


            radioGroup = (RadioGroup) view.findViewById(R.id.radioGroup1);
            radioGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() 
            {
                public void onCheckedChanged(RadioGroup group, int checkedId) {

                 ContentValues values = new ContentValues();
                    switch (checkedId) {
                    case PRESENT:
                        values.put(AttendanceContentProvider.PRESENT, checkedId);
                        break;
                    case ABSENT:
                        values.put(AttendanceContentProvider.ABSENT, checkedId);
                        break;
                    case LEAVE:
                        values.put(AttendanceContentProvider.LEAVE, checkedId);
                        break;

                    default:
                        break;
                    }

                   String where = "((" + 
                            AttendanceContentProvider._ID + " LIKE '"+_id_+"') AND (" +
                            AttendanceContentProvider.STUDENT_NAME + " LIKE '"+_name_+"') AND (" +
                            AttendanceContentProvider._ID + " NOTNULL ))";
                    getActivity().getContentResolver().update(AttendanceContentProvider.STUDENTS_URI, values, where, null);


                }
            });

        }
4

0 回答 0