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 trialMUZ140667 Tawanda Shoko
4,152 PointsChallenge 2: Error Message with Dialogs: Build a self destructing message android app.
I'm getting stuck here, may someone help. Thanks
import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.widget.EditText;
public class GuessNumberActivity extends Activity {
protected String mUserInput;
protected EditText mNumberField;
/*
* onCreate() and other code has been omitted for brevity!
*/
public void makeGuess() {
// Set mUserInput here!
mUserInput = mNumberField.setText().toString;
// Check to see if the user's number is correct
boolean isCorrect = GuessEngine.testGuess(mUserInput);
}
}
1 Answer
James Simshaw
28,738 PointsHello,
You have two issues with your code for this Task. First, you want to call getText() instead of setText() since you are trying to get the text from the EditText. Second, you need to add parentesis after your toString since it is a function. Please let us know if this helps or if you need more assistance. If you do need more assistance, please provide your updated code so we can help you from where you currently are at.