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) User Input Getting Text from an EditText

Why use toString()?

At around 05:40, toString() is used. Can you also cast the Editable to a String like we did in previous lessons? Or does that not work for strings?

Ham Hamey
Ham Hamey
5,712 Points

It doesn't toString method is used to get a suitable string format from the edittext string for more info reffer example link

1 Answer

J A
seal-mask
.a{fill-rule:evenodd;}techdegree
J A
Full Stack JavaScript Techdegree Student 4,646 Points

The getText() method does not return a String, but an editable type. That object needs to be converted to a String in order to be stored in the name variable.