Home > Tricks & Tips > ListView doesn’t respond to OnItemClickListener

ListView doesn’t respond to OnItemClickListener

There will be case that your custom list item doesn’t respond when you click…so what’s the reason and what’s the solution?

Here several problems and solutions:

1. Scenario: list item layout contains CheckBox

Problem: OnItemClickListener doesn’t respond.

Reason: CheckBox is also having its own click listener by default to change its state, and it overrides the container ListView.

Solution: remove focus on CheckBox by setting these attributes to “false”


2. Scenario: random

Problem: OnItemClickListener just doesn’t repond any at all!!!!

Reason: No idea..

Solution: in code, just set OnItemClickListener before setting Adapter. It works randomly @@!

3. Scenario: list item contains ImageButton

Problem: OnItemClickListener just doesn’t repond any at all!!!!

Reason: No idea!!!

Solution: in code, set ImageButton focus to “false”

ImageButton button = (ImageButton) convertView.findViewById(R.id.imageButton);

4. Scenario: list item contain TextView

Problem: OnItemClickListener just doesn’t repond.

Reason: I think you have set this attribute to TextView: android:inputType=”textMultiLine”

Solution: just remove that attribute, using android:minLines/android:maxLines instead.

5. Scenario: list item contain a TextView that is linked to website URL or whatever “mailto:” things

Problem: OnItemClickListener just doesn’t repond.

Reason: the TextView overrides focus of list item.

Solution: just remove attribute “android:autoLink” on TextView.


Hope you solve your problems!


Pete Houston

  1. salim
    March 11, 2016 at 4:55 pm


  2. Gopinath
    January 7, 2016 at 8:50 pm

    if list contains webview, how to get clicked position?

  3. April 29, 2015 at 5:27 pm

    Thank’s a lot ! was in scenario 1 !

  4. thomas
    April 21, 2015 at 9:24 pm

    Thank you so much, that really helps!

  5. Renan Siqueira
    February 7, 2015 at 12:43 am

    Another solution, remove the “android:clicable:true” on the block inside ListView.

  6. October 6, 2014 at 5:11 am

    Wow! After all I got a website from where I know how to really get useful facts regarding my
    study and knowledge.

  7. September 17, 2014 at 6:13 am

    What if each Listview item has a radio button with the footer view with a real button instead?

  8. September 13, 2014 at 10:04 am

    Here is one more solution : Remove “android:longClickable=”true”” in the layout. Long click will still work, so there is no need to really have it.

  9. Kononjump
    December 31, 2013 at 7:23 pm

    Realy big thanks to you!

  10. September 10, 2013 at 7:31 pm

    really great ans.. I am very thank full to you.. nice tutorial man.. no words to say … keep posting…

  11. Mahmoud El-Maghraby
    August 23, 2013 at 11:21 pm

    Awesome post, I got my problem solved 🙂

  12. July 13, 2013 at 7:14 pm

    2. Scenario
    work 😀

  13. rupeshsasne
    May 17, 2013 at 12:10 am

    Hi Pete,

    I have applied your instructions to following code.

    Here I have added `onClickListener` and `setFocusable(false)` to root layout of a list item, please have a look at following,

    this is a part of list item layout “list_item”.

    [..Some code..]

    and the getView of adapter has following code,

    if (convertView == null) {
    LayoutInflater inflater = (LayoutInflater) ctx.getSystemService(

    convertView = inflater.inflate(R.layout.list_item,


    [..Some code..]

    Still the list view’s `onItemClick` method is not getting called.

    Any solution?


  14. Tmr
    May 15, 2013 at 2:20 pm

    I lost my full day without visiting your page. great post

  15. Manu
    March 24, 2013 at 12:32 am

    THANK YOU! I was looking hundreds of pages without success, but your solution worked like a charm!

  16. Chaim
    February 17, 2013 at 8:49 pm

    Thank you!

  17. keivn
    February 14, 2013 at 11:48 pm

    thanks a lot

  18. Paul Kim
    December 27, 2012 at 3:14 pm

    Thank you I love your advice!!!

  19. Jorge
    December 4, 2012 at 3:14 am

    Pete for me doesn’t works! Pls help me … I use a class extends BaseAdapter and then I inflate a ListView from Fragment …. Finally, I want to use a OnItemClickListener … and thats method not responding 😦 ….

  20. user
    December 3, 2012 at 2:42 pm

    Thanks a ton. 🙂

  21. Shahab Ahmad
    November 29, 2012 at 6:01 pm

    very nice…work Thanks a lot!!!!!!!!!!!

  22. governmentauctions
    July 19, 2012 at 8:20 pm

    Gday!Now I am at work surfing around your website by my own new iphone! Only just need to mention I really enjoy studying your own www and also start looking in front to all of your writes! Keep up the actual superb work!

    June 8, 2012 at 12:56 pm

    i tried all the above but not able to fire onItemClick on ListView. I inflated two ImageViews,three TextViews

  24. Faiz
    May 24, 2012 at 2:03 pm

    there is another case also. if your view contains table layout as root element then onItemClickListener will not respond. just add android:clickable=”false” to table layout.

  25. gaurav shukla
    May 23, 2012 at 3:32 pm

    Help me allot…… thanks u so so so much…..

  26. Thanks!
    February 16, 2012 at 9:13 am

    I found the reason for Scenario 3.

    There is a feature of the ImageButton in Android: it cannot be set to non-focusable using xml attribute, because someone explicitly calls setFocusable(true) in the constructor: see source***. There is an issue submitted, but it seems that the Android team will not fix it: https://review.source.android.com/15203


  27. Thanks!
    February 16, 2012 at 9:08 am

    Thank you!! The Scenario 3 fix worked perfectly for me. Who would have thought that setting focusable to false programmatically would work when setting it in XML didn’t?

  28. Thanks!
    February 16, 2012 at 9:08 am

    Thank you!! Scenario worked perfectly for me. Who would have thought that setting focusable to false programmatically would work when setting it in XML didn’t?

  29. Juan
    February 3, 2012 at 11:37 pm

    Thanks, I was in case #1 I had a work arond for this but now I know the real cause of the issue.

  30. Meghana
    January 30, 2012 at 8:25 pm

    Thanks, worked for me! Saved a lot of my time 🙂 Great work !!!

  31. mav3656
    January 25, 2012 at 10:58 pm

    Thank’s a lot ! was in scenario 3 !
    In xml, doesn’t work to set focusable to false. But in code, you are right. That solved my problem. Thanks !

  32. rooban abraham
    January 10, 2012 at 8:49 pm

    Nice post , really helped me 🙂

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: