Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Android Build a Self-Destructing Message Android App Sending Messages Sending the Message

john appleby
john appleby
2,773 Points

declare a String variable and store the value from the mDescriptionField

hey Ben, im a little bit stuck here .... in my understanding this is how you declare a string and add a value to it.... where am I going wrong ?

// Some code omitted!

public void save() {
  ParseObject task = new ParseObject("Task");
  String description = getText(mDescriptionField);


thanks for any pointers

3 Answers

I hope Ben doesn't mine here...Without giving you the answer, you have to get the value from an "EditText" field and then use additional properties to associate it with a string. I hope this helps.

If you are still stuck google "get value from edittext"

getText() is a method of the EditText class (which mDescriptionField is an object of). So you need to call getText() like this

String description = mDescriptionField.getText().toString();

You have to call toString() because getText() returns an Editable object, so you have to convert that to a string if you want to store it in a string variable.

john appleby
john appleby
2,773 Points

Thanks Ben & Jonathan, now I understand, its just a bit confusing but Ive wrapped my head round that concept now and had a look at some google examples. thanks again for helping me over this wall made of .String