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 Making a Button Do Something

Auto completion not showing SetOnclickListener

I choose to only support Lollipop is that the reason?

Gents?

1 Answer

adam stein
adam stein
17,057 Points

Sorry for having just noticed this question now. Hopefully this answer can still be of use to someone...

Java is a case sensitive language. By capitalizing the 'S' in "SetOnclickListener" your IDE is reading it as an entirely new method hence autocomplete is ignoring you. EVERYONE MAKES MISTAKES LIKE THESE. I still do all the time. I've even seen TreeHouse instructors gloss over a typo and try to run their application.

As a side note, a common convention in many programming languages is naming fields and methods with camel case ie 'setOnclickListener'. https://en.wikipedia.org/wiki/CamelCase.

As another side note, I can't stress how helpful it was for my own learning to switch over to the java track before diving into this one. I have hardly mastered the language, but after returning to this track, I can follow along with greater ease. Unlike my first attempt at this track, I don't feel as though I'm just taking Ben's word for everything. Having knowledge of object oriented programming to rely on as a reference point is quickly paying off!