title: get items that check on checkbox android
body: <p>I want to get the items to be checked with the checkbox. This is the adapter code:</p>
  <pre><code> holder.checkb.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
              @Override
              public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                  if (isChecked){
                      projectEntityList.get(position).setSelected(holder.checkb.isChecked());
  
                  }
              }
          });
  </code></pre>
  <p>Then here I want to use the items that have been checked. When I query for list of projects, the selected items are saved, but when it enters the for, all the items that were checked become unChecked.</p>
  <pre><code> private void addProject() {
          try {
              projectEntityList = DatabaseManager.getDatabaseHelper(this).getProjectDao().queryForAll();
              for (int i = 0; i &lt; projectEntityList.size(); i++) {
                  if (projectEntityList.get(i).isSelected()) {
                      helper.getProjectDao().createOrUpdate(projectEntityList.get(i));
                  }
  
              }
              Log.i(&quot;TESTTEST&quot;,   &quot;projectEntity&quot; + projectEntity);
          } catch (SQLException e) {
              e.printStackTrace();
          }
  
  
      }
  </code></pre>
  <p>look at the debugs photo:</p>
  <p><a href="https://i.stack.imgur.com/fjAEo.png" rel="nofollow noreferrer">debug before for</a></p>
  <p><a href="https://i.stack.imgur.com/r9jma.png" rel="nofollow noreferrer">debug after for</a></p>