If you have an item in ListView that is focusable or has a focusable
child, then OnListItemClick is not fired. In this case you have to use
the OnClickListener of the item or of its children.

On Tue, Nov 4, 2008 at 5:43 PM, Chris McCurdy
> I was looking at that code, and it doesn't look like it would allow me
> to select specific items in the ListView aside from setting the
> ratings per row. I'll give it a try later anyway.
> I actually tried to set a custom OnClickListener for the view that is
> returned from my custom ListAdapter, and it showed me that the
> CheckBox isn't actually stealing the clicks. The rest of the
> LinearLayout still recognizes that there is a click event, but the
> ListView doesn't run the onListItemClicked method. And if I call
> setSelected on the list item in the onClick method of the listener,
> immediately afterward, the ListActivity returns what looks like an
> uninitialized value for getSelectedItemId (-9223372036854775808 is the
> precise value it returns for every item I click on).
> On Nov 4, 5:55 pm, Mark Murphy <[EMAIL PROTECTED]> wrote:
>> Chris McCurdy wrote:
>> > I have a ListView with a complex widget for displaying list items. It
>> > has a CheckBox and several TextViews. I want to be able to handle
>> > clicks to the CheckBox and be able to do the normal things on the list
>> > item when anywhere that's not the CheckBox is clicked (e.g. context
>> > menus, onListItemClick(), etc.). The problem is that when the CheckBox
>> > is visible, it removes the ability for any other part of the item to
>> > receive clicks, even if the CheckBox itself isn't receiving the click
>> > events. Is there any way to prevent it from "stealing" the click
>> > events from the rest of the items in the widget?
>> You can take a peek at the last tutorial in my Fancy ListViews series
>> over on AndroidGuys:
>> http://androidguys.com/?p=659
>> It uses a RatingBar instead of a CheckBox, since Android 1.0 supports
>> ListViews with checkable items now. It's also written for the 0.9 SDK
>> and may require minor changes to work under 1.0r1. And forgive the
>> formatting -- the AndroidGuys site changed stylesheets when it moved to
>> a new hosting provider and my older posts are somewhat fouled up.
>> --
>> Mark Murphy (a Commons Guy)http://commonsware.com
>> _The Busy Coder's Guide to Android Development_ Version 1.4 Published!
> >

Romain Guy

You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
For more options, visit this group at

Reply via email to