I have a problem with custom listview item click.
In my activity I have a button and a custom ListView such that on clicking the button, checkboxes appear to left of each item, and again on clicking the button, checkboxes disappear.By default on clicking the item, it should display Toast1, and on clicking the button(when checkboxes enabled), it should display Toast2.So the button acts like a toggle button.
So I have written ListView.onitemclickListener in Activity to display Toast1 and convertView.setOnClickListener in getView to display Toast2.
In getView(), I have written :
if(myFlag)
{
convertView.setOnClickListener ...
{
display Toast2
}
}
here myFlag will be set true/false based on the toggle button.
But when after clicking toggle button and clicking on listview item, sometimes its displays Toast1 and sometimes Toast2.
Finally I got solved this myself.
Just set the setclickable() of convertView to true/false in getView() method. If set to true Toast2 will displayed() and if set to False Toast1 will be displayed.