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

Android Build a Simple Android App (2014) Basic Android Programming Adding the onClick() Method

Ayush Bhargava
Ayush Bhargava
791 Points

My set on click listener is in red and listener is underlined in red

this is my line 30 where the errors are showFactButton.setOnClickListener(Listener);

David Anton
David Anton
Courses Plus Student 30,936 Points

I think you used the listener variable in Anonymous function, that's mean you have to type final before the declaration of listener.

2 Answers

Ollie Prentice
Ollie Prentice
11,685 Points

I think it might be a problem with case. Inside the bracket try a lower case 'l' on listener.

 showFactButton.setOnClickListener(listener);