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 Android Activity Lifecycle The Activity Lifecycle Saving and Retrieving Instance State

android 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

Hi 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 :)

thank you! i;ll do likewise

You're welcome! :)