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 trialGeorge Sioutos
Courses Plus Student 236 Pointstrouble with setonclicklistener
Newfact.setOnclicklistener(); I get error
Error:(22, 16) error: cannot find symbol method setOnclicklistener() Error:Execution failed for task ':app:compileDebugJava'.
Compilation failed; see the compiler error output for details.
1 Answer
Alex Alexander
5,673 PointsJava is case-sensitive, and you've called the method with inaccurate casing. You need to call setOnClickListener().
Hope that helps, let me know if you're still having issues.
P.S. It's a convention in Java to begin local variables with a lowercase letter, and then capitalize the first letter of each subsequent word in the variable name. So it would be more proper if your variable was named newFact. You can read more about naming conventions in the Oracle documentation.