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

CodeChallenge problem

For some reason the editor will not accept my answer. It asks me to make a String description, and put the value of an EditText member variable int called mDescriptionField. My answer was String description = mDescriptionField.toString(); However, it gave me an error saying Bummer! Make sure you get the text from the EditText variable! I do not understand why it gives me this error as I believe this is what I have done. Can somebody please tell me if there is a problem in my code, or how you fixed it.

Do you want to post the screenshot of the question?

2 Answers

Never mind that. I figured out that I needed to add getText() to mDescriptionField.toString().

import android.app.Activity; import android.widget.EditText; import android.widget.Toast; import com.parse.ParseException; import com.parse.ParseObject; import com.parse.SaveCallback;

public class MainActivity extends Activity {

protected EditText mDescriptionField;

protected SaveCallback mSaveCallback = new SaveCallback() {
    @Override
    public void done(ParseException e) {
        Toast.makeText(MainActivity.this, "Item saved!", Toast.LENGTH_SHORT).show();
    }
};

// Some code omitted!

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

}

//this is code

The description of the to-do item is stored in the EditText member variable. Declare a string named description and store the value from the EditText in it. Bummer! Make sure you get the text from the EditText variable!

//this is instructions and error