Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Caleb Kester
1,710 PointsOnItemClickListener on ListView (Blog App Extra Credit)
I'm trying to add an onlick listener to the listview for the extra credit assignment. However all of my research uses a button to trigger the events but not the actual list view list.
Is this possible?
1 Answer
Ronny Kibet
47,409 PointsHey Caleb, if I understand your question correctly, you have buttons inside a listview and you would like to set an on list item click on the listview and not the buttons themselves right? If so, then you can set the button's android:focusable="false"
Let me know if this solves it. :)
Caleb Kester
1,710 PointsCaleb Kester
1,710 PointsDo I have to add buttons? The instruction makes it sound like I can just add it by clicking on the list.
Clicks Ahoy!
See if you can add interactivity to your ListView using an OnItemClickListener. Display a message in a Toast, write something to the log, or even try navigating to a new activity.