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 trialEric Park
4,557 PointsCannot resolve symbol setOnClickListener
Hi, When I try to put in setOnClickListener, I always get the error "cannot resolve symbol setOnClickListener. What should I do? I have tried to import and implement view.OnClickListener in my Activity, but it doesn't seem to help. Any suggestions would be much appreciated, Thanks!
2 Answers
Gavin Ralston
28,770 PointsMake sure you're using View.OnClickListener and not lowercase "view.OnClickListener"
View is a class, so it's capitalized.
If you're still having trouble, post your code in a reply so we can view it. :)
Tobias Kloy
Full Stack JavaScript Techdegree Student 12,385 PointsI had View.onClickListener instead of View.OnClickListener - took me a while to figure out... Sometimes you are blind ;)
Eric Park
4,557 PointsEric Park
4,557 PointsHi, I rechecked my code and saw that I had capitalized 'V' in 'view'. I went through a couple other things and figured out that I forgot to put setOnClickListener in the onCreate method. Once I tried that, it seemed to be working fine. Thanks for your help tho! :) (and Merry Christmas!! :) )