I'm using a listview with checkboxes and set it to multi_choice.
Everything works fine if I'm doing a one time getCheckeItemPositions to get the checked listview items.
However if I do it again and uncheck one of the items, its still counted as checked. I can only add more items to "checked". How to solve this?
sp = new SparseBooleanArray();
lTransfer = new ArrayList<String>();
ListView info = (ListView)findViewById(R.id.info);
sp = info.getCheckedItemPositions();
Log.d("Watcher","Arraysize:" + sp.size());
for(int i = 0; i< sp.size();i++){
Log.d("Watcher","Arrayfound:" + info.getAdapter().getItem(sp.keyAt(i)).toString().split(":")[0]);
lTransfer.add(info.getAdapter().getItem(sp.keyAt(i)).toString().split(":")[0]);
}
public void updateInfo(){
ListView info = (ListView)findViewById(R.id.info);
info.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
info.setItemsCanFocus(false);
info.setOnItemClickListener(new InfoListener());
lSpin = new ArrayAdapter<String>(this, R.layout.list_item, lToAdd);
info.setAdapter(lSpin);
}