I have a listview that extends a baseadapter. And following the hint of this topic with the @ramaral's answer I was able to make the item select and deselect but now how do I check to see if the item is selected?
listview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (view.isSelected()){
Toast.makeText(lista.getContext(),"SELECIONADO",Toast.LENGTH_SHORT).show();
}else {
Toast.makeText(lista.getContext(),"NÃO SELECIONADO",Toast.LENGTH_SHORT).show();
}
}
});
With this code it is only displaying: "NOT SELECTED" Regardless whether the item is selected or not. Can you help me?