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!

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

Auto completion not showing SetOnclickListener

I choose to only support Lollipop is that the reason?


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!