As Romain said, top-level View has to be Checkable. A solution could
be to make a custom container implementing Checkable interface, then
use that container as top-level View for your row. Overriden methods
just call analog methods in Checkable item inside the container.
Example:
public class Che
OK. I am an idiot.
This was not working for me because I had left-over code in onCreate from
something else I tried:
//listView.setItemsCanFocus(false);
//listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
In the process I learned an awful lot from Mark Murphy's examples in
Does anyone know if this thread ended well? I attempting to create a fancy
list with a multiple selection (in 1.6).
The following code give seemingly random results using a SimpleCursorAdapter
...
@Override
protected void onListItemClick(ListView l, View v, int position, long
id) {
> @Romain-
> Thanks for responding. setChoiceMode is set to Mutiple choice. But it
> doesnt check the row. Thats why I am manually trying it.
That's because the top-level View in your item has to be Checkable.
It's a current limitation of ListView :(
>
> On Feb 16, 4:12 am, Mark Murphy wrote:
>
Hi Mark,
Thanks for the suggestion. I did try casting before and I've tried it
again. It gives me a 'InvocationTargetException' when I cast it. When
I put a debug watch for 'v' (the second parameter to onListItemClick
()), i see that 'v' is of type 'LinearLayout'. Under 'v', I also see a
View[] an
Do not handle the checked state yourself. ListView recyles the view
which can cause trouble. Lookup setChoiceMode() instead and refer to
the ApiDemos for examples.
On Sun, Feb 15, 2009 at 5:42 AM, Shams wrote:
>
> Hello,
> I have a custom multi-select listview with two lines per row and a
> chec
Shams wrote:
> Hello,
> I have a custom multi-select listview with two lines per row and a
> checkbox in the first line. When I click on the checkbox, the checbox
> does not get checked. But the list items get checked/ unchecked. I
> want to check the checkbox corresponding to the row I clicked. I
7 matches
Mail list logo