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

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.