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 trialmariko muranishi
860 Pointswhat is the ID?
I think I understand what the ID is by intuition, but I don't understand what the ID is more. please explain it more concretely.
1 Answer
Evgeniia Vakarina
3,317 PointsID is used in XMLs so you can access your views in java files. This all is done by the magic of R - the class that is built automatically by Android Studio and that registers all the resources (stuff in res folder) you want to access from a java class. E.g. if you need to access a picture you can put it in drawable folder and then access it from an activity by R.drawable.[file_name], by the same logic you access the views from XML - R.layout.[id]