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 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!