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) Finishing the User Interface Using a Model in the Controller

Fortune Jackson-Bartelmus
Fortune Jackson-Bartelmus
1,273 Points

I do not know how to incorporate the getter method into this class

I do not know how to incorporate the getter method into this class

1 Answer

Hello,

If you look in the Spaceship.java file, you'll notice a few methods that start with the word get. These methods are called getters which allow you to get the value of that particular variable. This is a common convention used in programming, to limit how viewable a variable is and to provide a getter and/or a setter(which is prefixed with set in the method name).

So in this case, you want to change the displayed text in the mTypeLabel TextView to be the same as mSpaceship's mType variable. To access that variable's value, just call the proper method from mSpaceship that will return the value of mType.

If you have any further questions, could you please provide your source code for what you attempt so that we can help you with any specific problems you have with using the getter.