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 trialtinashe ibu
5,881 Pointsandroid question on initializing a key name
Hello guys! i am new to android dev. how do i initialize a key? for example, initialize a key named KEY_USERENTRY?
1 Answer
Lauren Moineau
9,483 PointsHi Tinashe. A key here is just a variable, so you initialise it as you do any other variable. You declare it giving it a type and a name, and you assign it a value. The only difference is that it's a constant so it will be static final
. If you're still confused, you can rewatch the 3rd video at around 4:30 where it is explained.
If you are new to Android, I would suggest you start with the Android Beginner track. If I'm not mistaken, this Activity Lifecycle course is part of the Intermediate Android track so it might be best to start with the basic track as a foundation course set.
Hope that helps :)
tinashe ibu
5,881 Pointstinashe ibu
5,881 Pointsthank you! i;ll do likewise
Lauren Moineau
9,483 PointsLauren Moineau
9,483 PointsYou're welcome! :)