title: Get list of checked checkboxes from recyclerview android
body: <p>I have populated the recyclerView with image, title and checkbox.
  I have two problems.</p>
  
  <ol>
  <li><p>How to make the checkbox selected when the imageview or the whole recycler item is clicked.</p></li>
  <li><p>I have to go to next activity by getting all the checked items from the recyclerview.</p></li>
  </ol>
  
  <p>My layout :</p>
  
  <pre><code>&lt;RelativeLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_margin="8dp"&gt;
  
      &lt;ImageView
          android:id="@+id/image"
          android:layout_width="match_parent"
          android:layout_height="150dp"
          android:layout_gravity="center_horizontal"
          android:contentDescription="Interests"
          android:scaleType="centerCrop"
          android:src="@drawable/ic_yash_dp" /&gt;
  
      &lt;TextView
          android:id="@+id/title"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentBottom="true"
          android:layout_alignParentLeft="true"
          android:layout_alignParentStart="true"
          android:layout_gravity="bottom"
          android:layout_margin="5dp"
          android:layout_marginTop="24dp"
          android:background="@drawable/rounded_corners"
          android:gravity="bottom"
          android:padding="5dp"
          android:text="GYM"
          android:textAlignment="center"
          android:textColor="@color/white" /&gt;
  
      &lt;CheckBox
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:id="@+id/checkBox"
          android:layout_margin="2dp"
          android:layout_alignParentTop="true"
          android:layout_alignParentRight="true"
          android:layout_alignParentEnd="true" /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>My adapter:</p>
  
  <pre><code>@Override
  public void onBindViewHolder(RecyclerViewHolder holder, int position) {
  
      final InterestBean model = arrayList.get(position);
      final int pos = position;
  
      RecyclerViewHolder mainHolder = (RecyclerViewHolder) holder;// holder
  
      Bitmap image = BitmapFactory.decodeResource(context.getResources(),
      model.getImage());// This will convert drawbale image into bitmap
  
      // setting title
      mainHolder.title.setText(model.getTitle());
      mainHolder.imageview.setImageBitmap(image);
      mainHolder.checkBox.setChecked(arrayList.get(position).isSelected());
      mainHolder.checkBox.setTag(arrayList.get(position));
  
      mainHolder.checkBox.setOnClickListener(new View.OnClickListener() {
          public void onClick(View v) {
              CheckBox cb = (CheckBox) v;
              InterestBean contact = (InterestBean) cb.getTag();
  
              contact.setIsSelected(cb.isChecked());
              arrayList.get(pos).setIsSelected(cb.isChecked());
              selectedItems.add(pos);
              Toast.makeText(v.getContext(), pos + cb.isChecked(), Toast.LENGTH_LONG).show();
          }
      });
  }
  </code></pre>