0

カスタムリストビューで単一選択チェックボックスを使用したいのですが、カスタムアダプターのgetviewメソッドは次のとおりです。

@Override
public View getView(final int position, View convertView, ViewGroup parent) {
    LayoutInflater inflater = (LayoutInflater) context
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View rowView =convertView;
    ViewHolder holder;

    if (rowView == null) {
    rowView = inflater.inflate(R.layout.row_timeslot, parent, false);
    holder = new ViewHolder();
    holder.title = (TextView) rowView.findViewById(R.id.textView2);
    holder.layout=(RelativeLayout)rowView.findViewById(R.id.relativeLayout1);
    holder.check=(org.holoeverywhere.widget.CheckBox)rowView.findViewById(R.id.checkBox1);


    rowView.setTag(holder);
    }
    else
    {
        holder=(ViewHolder) rowView.getTag();
    }

    HashMap<String, String> trends_data= new HashMap<String, String>();
    trends_data = trendsobj.get(position);


     holder.check.setId(position);



     holder.check.setChecked(checkarry[position]);


     //for managing the state of the boolean
     //array according to the state of the
     //CheckBox



     holder.check.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            if (((CheckBox) v).isChecked())
            {
                checkarry[position] = true;

            }


            else
            {
                checkarry[position] = false;

            }
        }
    });


    holder.title.setText(trends_data.get(BookingActivity.KEY_TIME_TITLE));




    return rowView;
}

別のチェックボックスがチェックされているときに、チェックされたチェックボックスのチェックを外したい。どんな助けでも大歓迎です。ありがとうございました。

4

1 に答える 1