Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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);