title: how to get checked multiple values using custom adapter in android
body: <p>I have listview with custom adapter. Every element of this listview has checkbox. Standart function <code>.isChecked()</code> does not work.</p>
  
  <p>someActivity.java</p>
  
  <pre><code>@Override
  protected void onCreate(Bundle savedInstanceState) {
      btnShare.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
  
              List&lt;Boolean&gt; listCheck;
              listCheck = new ArrayList&lt;Boolean&gt;();
  
              for (int i = 0; i &lt; CA_main_trx.editModelArrayList.size(); i++){
                  Boolean stat = CA_main_trx.editModelArrayList.get(i).getCheckShare();
                  String nilaiPcs = CA_main_trx.editModelArrayList.get(i).getTextView_main_trx2();
                  Log.d(TAG, "onClick: --a" + nilaiPcs);
                  Log.d(TAG, "onClick: --a" + stat);
              }
          }
      });
  </code></pre>
  
  <p>CustomeAdapter</p>
  
  <pre><code>    @Override
      public View getView(final int position, View convertView, ViewGroup parent) {
          final ViewHolder holder;
          final String TAG = "CA_Main_Trx : ";
  ...
          holder.checkShare.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
              @Override
              public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
                  if(b){
                      String id = editModelArrayList.get(position).getTextView_main_trx0();
                      Log.d(TAG, "onCheckedChanged: True"+id);
                  }
                  else
                      Log.d(TAG, "onCheckedChanged: False");
              }
  
          });
  ...
  </code></pre>
  
  <p>model</p>
  
  <pre><code>package com.m.t;
  
  public class EM_main_trx {
  
      private boolean checkShare;
  
      public Boolean getCheckShare() {return checkShare;}
  
      public void setCheckShare(Boolean checkShare) {
          this.checkShare = checkShare;
      }
  }
  </code></pre>
  
  <p>When checked in custome Adapter i get the checked status. But when i get the data using button in my mainactivity i got stuck. just got null.</p>
  
  <p>Some my reference :</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/9411540/android-get-checked-checkbox-values">Android: Get checked checkbox values</a></li>
  <li><a href="https://stackoverflow.com/questions/7953697/finding-the-checked-state-of-checkbox-in-a-custom-listview">Finding the Checked state of checkbox in a custom listview</a></li>
  <li><a href="https://stackoverflow.com/questions/28192850/how-to-get-the-the-multiple-checkbox-values-using-custom-adapter-in-android">how to get the the multiple checkbox values using custom adapter in android</a></li>
  <li><a href="https://stackoverflow.com/questions/39385166/android-list-view-custom-adapter-with-checkbox-multiple-selection-and-search-lis">Android List View Custom Adapter with Checkbox multiple selection and Search Listview</a></li>
  <li><a href="https://stackoverflow.com/questions/22910936/checked-values-of-checkbox-with-custom-listview-android">Checked values of CheckBox with Custom Listview android</a></li>
  </ul>