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

Page text from string resource

I just made the interactive story app, and while it works perfectly as is, I was wondering: is it possible to put all the page text in the string resources file? How would that work? How (and where) would you call the string resource? Is it possible to add all the story pages' text in a string array in the strings.xml? And if so, how do you get the text for the one item to display on its appropriate page?

2 Answers

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Christine;

Take a look at the docs on string resources and post back if you are stuck on implementation.

Happy coding,

Ken

Thanks, but I did look at the docs first! That's what gave me the idea that the text should be in the string resources :) It's really the implementation that has me stuck, especially in the story app that we make in the Android course track. Would you have any suggestions/direction on how to do that?

You could do it by adding string resources for each individual item very easily. To add everything to a StringArray would require a re-write. Nice that you are thinking that way so early on though. Using string resources makes it very easy to localize your apps.