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 Build an Interactive Story App (Retired) The Model-View-Controller Pattern Adding Custom Constructors

Rene Keuter
Rene Keuter
1,803 Points

Where does the %1$s come from? I know it's the name that the user typed.

I see in the story ben wrote that he used this piece of code to refer to the name the user typed. It's not clear to me where to find it and how you get it in. Maybe a dumb question, but i think it's important for the story :)

2 Answers

Seth Kroger
Seth Kroger
56,414 Points

You'll be using String.format() to add the name into the story which uses the % sign to specify where and what to format. 1$ means the first argument after the format string, and s means it will be a string.

You can see all the gory details of format strings at http://developer.android.com/reference/java/util/Formatter.html