title: toogle listener associated with checkbox with adapter
body: <p>Im building a simple aplication with a recycleView/CardLayout, i followeed <a href="https://code.tutsplus.com/tutorials/getting-started-with-recyclerview-and-cardview-on-android--cms-23465" rel="nofollow noreferrer">this</a> tutorial.</p>
  
  <p>I see many questions answered for the card click, but what i need is to handle listeners with  diferent actions when the user clicks the title or the user clicks on the image <strong>in each card</strong>.</p>
  
  <p>My problem is, when the user clicks a radiobutton i need to get the radio on the listener so i can handle check and uncheck because i need to do pass that to a builder</p>
  
  <p>This is what i have at the moment:</p>
  
  <pre><code>public class SimiliarPlantsAdapter extends RecyclerView.Adapter&lt;SimiliarPlantsAdapter.PlantViewHolder&gt;{
  
      ArrayList&lt;Plant&gt; plants = new ArrayList&lt;Plant&gt;();
      Context context;
  
      public static class PlantViewHolder extends RecyclerView.ViewHolder {
          CardView cv;
          TextView plantName;
          CheckBox plantCheck;
          ImageView plantPhoto;
  
          PlantViewHolder(View itemView) {
              super(itemView);
              cv = (CardView)itemView.findViewById(R.id.cv);
              plantName = (TextView)itemView.findViewById(R.id.plantName);
              plantCheck = (CheckBox)itemView.findViewById(R.id.plantCheck);
              plantPhoto = (ImageView)itemView.findViewById(R.id.plantPhoto);
          }
  
      }
  
      @Override
      public PlantViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
          View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.similiar_photo_row, viewGroup, false);
          PlantViewHolder pvh = new PlantViewHolder(v);
          return pvh;
      }
  
      @Override
      public void onBindViewHolder(PlantViewHolder holder, int position) {
          holder.plantName.setText(plants.get(position).getSpecie());
          holder.plantCheck.setText("Are you sure this is the plant?");
  
  
          Log.d("foto",String.valueOf(holder.plantName));
  
  
          String urlFoto = "http://10.0.2.2:3000/images/" + holder.plantName.getText().toString() + "/Thumbnail.jpg";
          Picasso.with(context)
                  .load(urlFoto)
                  .resize(250, 250)
                  .into(holder.plantPhoto);
  
      }
  
      @Override
      public int getItemCount() {
          return plants.size();
      }
  
      public SimiliarPlantsAdapter(ArrayList&lt;Plant&gt; plants,Context context) {
          this.plants = plants;
          this.context = context;
      }
  
      public void onAttachedToRecyclerView(RecyclerView recyclerView) {
          super.onAttachedToRecyclerView(recyclerView);
      }
  
  }
  </code></pre>
  
  <p><strong>MY Activity</strong></p>
  
  <pre><code>public class SimiliarPhotos extends AppCompatActivity implements IResult,SimiliarPlantsAdapter.OnItemClickListener {
  
      RecyclerView rv;
      LinearLayoutManager llm;
      ArrayList&lt;Plant&gt; plants = new ArrayList&lt;Plant&gt;();
      SimiliarPlantsAdapter adapter;
      CheckBox checkBox;
  
      VolleyService mVolleyService;
      IResult mResultCallback = null;
      final String GETREQUEST = "GETCALL";
  
      //login url connection
      final String URL = "http://10.0.2.2:3000/plants";
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_similiar_photos);
  
          rv = (RecyclerView)findViewById(R.id.rv);
          llm = new LinearLayoutManager(this);
          llm.setAutoMeasureEnabled(true);
          rv.setLayoutManager(llm);
  
  
          initializeAdapter();
  
          initVolleyCallback();
  
          mVolleyService = new VolleyService(mResultCallback,this);
  
          mVolleyService.getDataVolley(GETREQUEST,URL);
      }
  
      @Override
      public void notifySuccess(String requestType, JSONObject response) {
          Log.d("resposta",response.toString());
      }
  
      @Override
      public void notifySuccess(String requestType, JSONArray response) {
          Log.d("resposta",response.toString());
      }
  
      @Override
      public void notifyError(String requestType, VolleyError error) {
          Log.d("resposta",error.toString());
      }
  
      void initVolleyCallback(){
          mResultCallback = new IResult() {
              @Override
              public void notifySuccess(String requestType, JSONObject response) {
          }
  
          @Override
          public void notifySuccess(String requestType, JSONArray response) {
              Plant plant;
              Log.d("ENTERED","ENTEREDHERE1");
              // iterate over the JSONArray response
              for (int i=0; i &lt; response.length(); i++) {
                  try {
                      JSONObject object = response.getJSONObject(i); // get the individual object from JSONArray
                      int id = Integer.parseInt(object.getString("id")); // get the unique identifier from the object
                      String specie = object.getString("specie"); // get the name of the specie from the object
                      String description = object.getString("description"); // get the description of the object
                      plant = new Plant(id,specie,description); // construct the object
                      Log.d("plant",String.valueOf(plant));
                      plants.add(plant); // add the object to the arraylist so it can be used on the cardLayout
  
                  } catch (JSONException e) {
                      Log.d("ENTERED",e.toString());
                      e.printStackTrace();
                  }
              }
              adapter.notifyDataSetChanged();
          }
  
          @Override
          public void notifyError(String requestType, VolleyError error) {
              Log.d("resposta",error.toString());
          }
      };
  }
  
  public void initializeAdapter(){
      Log.d("plants",String.valueOf(plants.size()));
      adapter = new SimiliarPlantsAdapter(plants,SimiliarPhotos.this,SimiliarPhotos.this);
      rv.setAdapter(adapter);
  }
  
  
  @Override
  public void onTitleClicked(int position, int id, View clickedview) {
  
  }
  
  @Override
  public void onImageClicked(int position, View clickedview) {
  
  }
  
  @Override
  public void onCheckClicked(int position, String specie, View clickedview) {
      adapter.getItemId(position);
      CreateDialog(specie);
  }
  
  public void CreateDialog(String specie){
      AlertDialog.Builder builder;
      if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.LOLLIPOP) {
          builder = new AlertDialog.Builder(SimiliarPhotos.this, android.R.style.Theme_Material_Dialog_Alert);
      } else {
          builder = new AlertDialog.Builder(SimiliarPhotos.this);
      }
      builder.setTitle("Esta é a sua escolha?")
              .setMessage("Confirma " + specie + " como a planta que fotografou?")
              .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
                  public void onClick(DialogInterface dialog, int which) {
                      //TODO associa nome da planta a fotografia na base de dados
                  }
              })
              .setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {
                  public void onClick(DialogInterface dialog, int which) {
                     dialog.dismiss();
                  }
              })
              .setIcon(android.R.drawable.ic_dialog_alert)
              .show();
      }
  }
  </code></pre>
  
  <p>The volley init is the request, not so important for the question, since i get the data correctly</p>