title: Getting checked items with custom adapter
body: <p>I have listview with custom adapter. Every element of this listview has checkbox. Standart function .getCheckedItemPositions() does not work. </p>
  
  <p>onCreate:</p>
  
  <pre><code>  final String[] words = new String[] {
                  "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13"
          };
  
  
          MySimpleArrayAdapter adapter = new MySimpleArrayAdapter(this, words);
          listView.setAdapter(adapter);
  </code></pre>
  
  <p>My adapter:</p>
  
  <pre><code>public class MySimpleArrayAdapter extends ArrayAdapter&lt;String&gt; {
      private final Context context;
      private final String[] values;
      DataBaseHelper myDbHelper;
      int id = 1;
  
  
      public MySimpleArrayAdapter(Context context, String[] values) {
          super(context, R.layout.listitem, values);
          this.context = context;
          this.values = values;
      }
  
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
  
          View rowView = inflater.inflate(R.layout.listitem, parent, false);
          CheckBox checkBox = (CheckBox)rowView.findViewById(R.id.checkBox);
          TextView newwordview = (TextView)rowView.findViewById(R.id.newwordview);
  
  
          newwordview.setText("lalala");
  
              return rowView;
      }
  }
  </code></pre>
  
  <p>Here i try to get checked items:</p>
  
  <pre><code>public void addbtnclick(View view){
          int cntChoice = listView.getCount();
          SparseBooleanArray sparseBooleanArray = listView.getCheckedItemPositions();
  
          for (int i = 0; i &lt; cntChoice; i++) {
  
              if (sparseBooleanArray.get(i) == true) {
                  String a = listView.getItemAtPosition(i).toString();
                  myDbHelper.setadd(a, "en");
              } else if (sparseBooleanArray.get(i) == false) {
  
              }
          }
      }
  </code></pre>
  
  <p>In debug sparseBooleanArray always has 0 items.
  What should I do?</p>