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

Rory Callendar
Rory Callendar
1,014 Points

Concept and Design

I'm making a choose your own adventure app and want to know if there is an easier way... ...I am creating an xml activity for each page, then using Ben's quick tip on switching pages to create buttons to take me to the pages of my choice. I have over 100 xml activities! ...is there an easier way? I know the answer is yes, but need to hear what should happen conceptually...I imagine it will involve having all my text in a table or maybe collected somewhere as objects...your ideas and input welcome...for now I will complete the project (all 114 pages) manually.

1 Answer

Ben Jakuben
STAFF
Ben Jakuben
Treehouse Teacher

Sounds cool! In this case, you'll want to take a look at your layouts and see which ones are similar. Can you group any together and reuse one layout with one Activity but different data?

For example, let's say a lot of your screens involve a picture, some text, and two buttons at the bottom. If the layout is the same, you could use one XML layout file and one Activity. You would then pass data into that Activity, like the image to use, the text, and the labels for the buttons, using a Bundle.