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.
Jvalant Dave4,483 Points
Challenge 2 of 3 for the following question?
"In the onSaveInstanceState method, save the number 10 to the bundle."
Not really sure what to do here. In the previous challenge, I put:
private static final String KEY_USERENTRY = "KEY_USERENTRY";
Not sure how this applies to the next question since it asks for a number instead of a string.
When you save something to the bundle it requires two arguments, a key (which is essentially a label for the data) and the actual data you want to save, the key is always a string regardless of what type of data you are saving to the bundle.
You were asked to create a KEY_USERENTRY variable because it is a common convention to store bundle keys as final variables in order to make it less likely that you make typos when you reference this key later on in the code.
That is how the first task relates to the second, as to how to solve the second task that is something that is shown off in the video that precedes the challenge, but I'll give you a hint, the bundle (which can be accessed though the outState variable) has a method called putInt, that takes a key as the first argument and an int as the second, and saves it to the bundle.
That info should help you solve the task.