Retrieve all Values of Checked Item in a custom Listview (Cursor Adapter)
<p>Good day, am having a bit of trouble and have been stuck here for a while now. I am trying to get all the checked items from a custom listview (for now, just the number of checked items) and nothing seems to work. this code returns 0 and i don't know what to try anymore. </p>

<pre><code>SparseBooleanArray checked = list.getCheckedItemPositions();
</code></pre>

<p>I have been able to successfully check and uncheck all the elements in the listview with this code:</p>

<pre><code>  for(int i=0; i &lt; list.getChildCount(); i++){  
  LinearLayout itemLayout= (LinearLayout)list.getChildAt(i);
  CheckBox checkbox =    (CheckBox)itemLayout.findViewById(R.id.media_checkbox_id);
       checkbox.setChecked(true);           
}
</code></pre>

<p>but i can't seem to get the number of checked items at all!!!.. please any help will be greatly appreciated. thank you.</p>
