jeudi 17 mars 2016

How to get all the checkboxes that are selected by the user

I have got a list view with checkboxes.

Following is my getView method,

@Override
    public View getView(int position, View convertView, ViewGroup parent) {
        view = convertView;

        if (convertView == null) {
            //inflate the view for each row of listview
            view = layoutInflater.inflate(R.layout.rating_item, null);
            mViewHolder = new ViewHolder();

            mViewHolder.mstatus = (TextView) view.findViewById(R.id.ratingStatus);
            mViewHolder.mCheckBox = (CheckBox) view.findViewById(R.id.checkBox);
            view.setTag(mViewHolder);
        } else {
            mViewHolder = (ViewHolder) view.getTag();
        }

        if (StarListHolder.getInstance().getStarOne().toString() != null) {

            String starTest = String.valueOf(listForView.get(position));
            ArrayList<String> starOne = StarListHolder.getInstance().getStarOne();
            List<String> starList = StarTest.getInstance().getStarList();
            mViewHolder.mstatus.setText(starList.get(position));
        }
        return view;
    }}

How can I know the number of check boxes that are being checked by the user.




Aucun commentaire:

Enregistrer un commentaire