Skip to content

Hi! Can anyone help with code? #3

@iRYO400

Description

@iRYO400

Can you help me with implementing it to the ViewPager's Adapter.
Here is code how I implemented basic CheckBox. RecyclerView with Multi items

@Override
    public void onBindViewHolder(final ViewHolder viewHolder, final int position) {
        final int pos = position;

        viewHolder.chkSelected.setOnCheckedChangeListener(null);
        viewHolder.chkSelected.setChecked(genreList.get(position).isSelected());
        viewHolder.chkSelected.setTag(genreList.get(position));
        viewHolder.chkSelected.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                CheckBox cb = (CheckBox) v;
                Genres gr = (Genres) cb.getTag();
                tinyDB = new TinyDB(v.getContext());

                if (cb.isChecked()) {
                    gr.setSelected(cb.isChecked());
                    genreList.get(pos).setSelected(cb.isChecked());
                    cgIntegerList.add(pos);
                } else {
                    cgIntegerList.remove(Integer.valueOf(pos));
                }
            }
        });

    }

Btw, nice CB! It looks awesome!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions