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

EMANUEL LUCIANO BAZAN
PLUS
EMANUEL LUCIANO BAZAN
Courses Plus Student 1,116 Points

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

Hi, im having a problem with this code, and i dont know why. I have tried several changes and it wont work can anyone help me out?

ToastTest.java
Toast allDoneToast;
allDoneToast.makeText(this, "All done!", Toast.LENGTH_LONG).show();

1 Answer

Hi there,

The first part of this wants tyou to create the Toast but not show() it just yet:

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

You can then sow it with:

allDoneToast.show();

The last part of the challenge, you have covered off already - it just wants the Toast created and shown in one line.

I hope that helps.

Steve.