title: E/UncaughtException: java.lang.ArrayIndexOutOfBoundsException: length=100; index=-1
body: <p>So I am creating a Habit tracker that adds a value everytime you check a checkbox on the viewHolder, the problem I am having is that when I have 6 or more habits on the list, the checkboxes dont work properly (They start checking in a random order) anymore and give me the error above.</p>
  
  <p>I am using this on my recycler adapter:</p>
  
  <pre><code>    public void onBindViewHolder(@NonNull final MyViewHolder holder, final int position){
          holder.nombre.setText(mHabitosList.get(position).getNombre());
  
  
            FirebaseDatabase mDatabase = FirebaseDatabase.getInstance();
            mDatabaseReference = mDatabase.getReference("Habitos");
            FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
            if(user != null) {
                userId = user.getUid();
                habitosReference = mDatabaseReference.child(userId);
  
                habitosReference.child(mHabitosList.get(holder.getAdapterPosition()).getHabitosId()).addValueEventListener(new ValueEventListener() {
                    @Override
                    public void onDataChange(DataSnapshot dataSnapshot) {
                          Habitos habitos = dataSnapshot.getValue(Habitos.class);
                          if(habitos != null) {
                              updateHabitosTotal[position] = habitos.getTotal();
                              checkBox1 = habitos.isCheckbox1();
                              checkBox2 = habitos.isCheckbox2();
                              checkBox3 = habitos.isCheckbox3();
                              checkBox4 = habitos.isCheckbox4();
                              checkBox5 = habitos.isCheckbox5();
                              checkListeners(holder, position);
  
                          }
  
                    }
  
                    @Override
                    public void onCancelled(DatabaseError databaseError) {
  
                    }
                });
      }  
  </code></pre>
  
  <p>On the check listener I have </p>
  
  <pre><code>private void checkListeners(@NonNull final MyViewHolder holder) {
          holder.CB1.setChecked(checkBox1);
          holder.CB1.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
              @Override
              public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
                  {
                      if (holder.getAdapterPosition() != RecyclerView.NO_POSITION) {
                          String HabitosId = mHabitosList.get(holder.getAdapterPosition()).getHabitosId();
                          int total = mHabitosList.get(holder.getAdapterPosition()).getTotal();
                          if (b) {
                              habitosReference.child(HabitosId).child("Checks").child(mDays[0]).setValue(true);
                              total++;
                          } else {
                              habitosReference.child(HabitosId).child("Checks").child(mDays[0]).setValue(false);
                              total--;
                          }
                          habitosReference.child(HabitosId).child("total").setValue(total);
                      }
                  }
              }
          });
  }
  .... And the same for CB2,CB3,CB4,CB5..
  </code></pre>
  
  <p>My apologies for the code dump... Any kind of help would be highly appreciated! (:</p>
  
  <p>Code Error:</p>
  
  <blockquote>
    <p>E/UncaughtException: java.lang.ArrayIndexOutOfBoundsException:
    length=20; index=-1
            at com.albot.focus.Adapters.HabitosAdapter$5.onCheckedChanged(HabitosAdapter.java:224)</p>
  </blockquote>