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 Simple Android App (2014) Testing and Debugging Making a Toast

String allDoneToast = "Message"; Toast.makeText(this, allDoneToast, Toast.LENGTH_LONG).show();

String allDoneToast = "Message"; Toast.makeText(this, allDoneToast, Toast.LENGTH_LONG).show();

That is why not work

1 Answer

Pauliina K
Pauliina K
1,973 Points

Hey! You have to rearrange your code a bit. It's almost right though! You don't have to write String, you just write the classname, Toast, and its name allDoneToast. After that you put an equal sign and there comes the Toast.makeText() method, instead of the message that you put there. Inside the parentheses you put this, message, Toast.LENGTH_LONG. The message in this case is "All done!". So it should look something like this:

Toast allDoneToast = Toast.makeText(this, "All done!", Toast.LENGTH_LONG);

For the second challenge you display it using the show-method, which looks like this:

allDoneToast.show(); 

And for the final challenge, you combine these two lines and make it into one:

Toast.makeText(this, "Whatever message you want to put here.", Toast.LENGTH_LONG).show();

So the only thing wrong with your code, if it's the last challenge you're stuck with, is that you put allDoneToast instead of the message.

Good luck!