I\'ve created a custom ListView by extending SimpleCursorAdapter. The result is IMAGE + CheckedTextView (Text + Checkbox).
After I had issues with the wrong checkbox
Why are you expecting getCheckedItemPositions() to return null if there aren't checked items? It looks like your choice mode is wrong
A SparseBooleanArray which will return true for each call to get(int position) where position is a position in the list, or null if the choice mode is set to CHOICE_MODE_NONE.
The array should only be null if it's choice_mode_none.
Why not try something like this?
if (((ListView) parent).getCheckedItemPositions().size() > 0){
findViewById(R.id.bottom_control_bar).setVisibility(LinearLayout.VISIBLE);
else{
findViewById(R.id.bottom_control_bar).setVisibility(LinearLayout.GONE;
}
Update
I'm pretty sure it has to do with this line
View v = inView;
if (v == null) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = inflater.inflate(R.layout.image_list, null);
}
You get the view, then reassign the view to the inflater. I'm kind of at a loss though at exactly why it would give the behavior you're exeriencing. You might also want to try the bindView()
method though I'm not sure why. Maybe instead of using the default android layout (the one you're giving to the setAdapter, make your own layout. It clearly is getting confused as to which view is assigned to which layout.