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 (retired 2014) Getting Started with Android Accessing Views in Code

Assigning Values to Variables

While working on this part of the project I discovered that when assigning values I had to write it differently than what was shown in the video. For example in the video you simply had to put findViewById(R.Id.texView1) would get what you needed. On my version I had to write findViewById(com.example.crystalball.R.id.textView1). It seemed to work just fine. I also noticed a lot more "id"s would show after typing in the "findViewById". Is this simply because I may be running a new version of eclipse than what is in the video?

1 Answer

IMHO There is nothing wrong with using fully qualified package names but we don't because we want to write less! This way of specifying name is required where we have multiple classes with same name in different packages as to distinguish which class is actually being called at runtime. Other than that you would not need to write it this way. Application specific Ids are defined in R class which is a generated java file and it contains values for all id, string, drawable, style, etcetera. So all the Ids would show up as you type.