title: how to have single choice on checkbox in recyclerview?
body: <p>I have a recyclerview that has a checkbox inside each item and I want the user to be able to check only one item.</p>
  <p>The solution I tested does not pick up the check.</p>
  <p>I saw many solutions that the one I tested had a higher score.</p>
  <p>It has to do this automatically.</p>
  <p>What should I do?</p>
  <p>I don't want to use RadioGroup</p>
  <p>Thanks in advance.</p>
  <p>DeveloperAdapter codes:</p>
  <pre><code>
  public class DeveloperAdapter extends RecyclerView.Adapter&lt;DeveloperAdapter.ViewHolder&gt; {
  
      private List&lt;DeveloperEntity&gt; developerEntities;
      private Context context;
      ArrayList&lt;Boolean&gt; positionArray;
  
  
  
      public DeveloperAdapter(List&lt;DeveloperEntity&gt; developerEntities, Context context) {
          this.developerEntities = developerEntities;
          this.context = context;
      }
  
  
      @NonNull
      @Override
      public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
          View view = LayoutInflater.from(context).inflate(R.layout.developer_adapter, parent, false);
          return new ViewHolder(view);
      }
  
  
      @Override
      public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
  
          final DeveloperEntity developerEntity = developerEntities.get(position);
          holder.mTxtName.setText(developerEntity.getName());
          holder.mTxtPosition.setText(developerEntity.getPosition());
  
          Drawable drawable = new
                  BitmapDrawable(Utility.byteArrayToBitmap(developerEntity.getImg()));
          holder.mImgPhoto.setImageDrawable(drawable);
          holder.mImgPhoto.setImageBitmap(BitmapFactory.decodeByteArray(developerEntity.getImg(), 0, developerEntity.getImg().length));
  
          setEditRemove(holder, position, developerEntity);
  
          try {
              developerEntities=DatabaseManager.getDatabaseHelper(context).getDeveloperDao().queryForAll();
          } catch (SQLException e) {
              e.printStackTrace();
          }
  
          positionArray = new ArrayList&lt;Boolean&gt;(developerEntities.size());
          for(int i =0;i&lt;developerEntities.size();i++){
              positionArray.add(false);
          }
      }
  
      private void setEditRemove(final ViewHolder holder, final int position, final DeveloperEntity developerEntity) {
          holder.mImgRemove.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  AlertDialog alertDialog = new AlertDialog.Builder(context)
                          .setTitle(&quot;Delete User&quot;)
                          .setMessage(&quot;Are you sure to delete this user?&quot;)
                          .setPositiveButton(&quot;Delete&quot;, new DialogInterface.OnClickListener() {
                              @Override
                              public void onClick(DialogInterface dialog, int which) {
                                  presentAlertDelete(holder.getAdapterPosition(), developerEntity.getId());
                              }
                          })
                          .setNegativeButton(&quot;No&quot;, null)
                          .create();
                  alertDialog.show();
  
              }
          });
          holder.mImgEdit.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  Intent intent = new Intent(context, AddDeveloperActivity.class);
                  intent.putExtra(&quot;id&quot;, developerEntity.getId());
                  context.startActivity(intent);
  
              }
          });
  
          holder.chkIsChecked.setOnCheckedChangeListener(null);
          if (positionArray!= null){
              holder.chkIsChecked.setChecked(positionArray.get(position));
  
          }
  
  
          holder.chkIsChecked.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
              @Override
              public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                  if(isChecked ){
                      positionArray.set(position, true);
  
                  }else
                      positionArray.set(position, false);
              }
  
  
          });
          Log.i(&quot;&quot;,&quot;&quot;+positionArray);
  
  
  
  
  
  
      }
  
      private void presentAlertDelete(int adapterPosition, long id) {
          try {
              DatabaseManager.getDatabaseHelper(context).getDeveloperDao().deleteById(id);
              developerEntities.remove(adapterPosition);
              notifyItemRemoved(adapterPosition);
              notifyItemChanged(adapterPosition, developerEntities.size());
          } catch (SQLException e) {
              e.printStackTrace();
          }
      }
  
      private void deleteUser(int adapterPosition) {
          developerEntities.remove(adapterPosition);
          notifyItemRemoved(adapterPosition);
          notifyItemChanged(adapterPosition, developerEntities.size());
      }
  
  
      @Override
      public int getItemCount() {
          return developerEntities == null ? 0 : developerEntities.size();
          //  return  userItemDeveloperDBS.size();
      }
  
      public class ViewHolder extends RecyclerView.ViewHolder {
          private CircleImageView mImgPhoto;
          private TextView mTxtName;
          private TextView mTxtPosition;
          private ImageView mImgEdit;
          private ImageView mImgRemove;
          private CheckBox chkIsChecked;
  
          public ViewHolder(@NonNull View itemView) {
              super(itemView);
              initView(itemView);
          }
  
          private void initView(@NonNull final View itemView) {
              mImgPhoto = (CircleImageView) itemView.findViewById(R.id.imgPhoto);
              mTxtName = (TextView) itemView.findViewById(R.id.txtName);
              mTxtPosition = (TextView) itemView.findViewById(R.id.txtPosition);
              mImgEdit = (ImageView) itemView.findViewById(R.id.imgEdit);
              mImgRemove = (ImageView) itemView.findViewById(R.id.imgRemove);
              chkIsChecked = itemView.findViewById(R.id.chkIsChecked);
          }
      }
  }
  </code></pre>