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

alex lewis
alex lewis
1,324 Points

Toast Task 3

I can't figure out what to do. I've made a bunch of changes and it still tells me there is a syntax error.

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

4 Answers

aaron joseph
aaron joseph
1,294 Points

Toast allDoneToast = Toast.makeText(this, "All done!", Toast.LENGTH_LONG); allDoneToast.show(); Toast.makeText(this, "Yay! Our activity was created!", Toast.LENGTH_LONG).show();

this should work

alex lewis
alex lewis
1,324 Points

This is my code:

Toast allDoneToast = Toast.makeText(this, "All done!", Toast.LENGTH.LONG); allDoneToast.show(); Toast.makeText(this, "Yay! Our activity was created!", Toast.LENGTH_LONG).show();

and this is what it tells me is the problem:

JavaTester.java:67: error: cannot find symbol Toast allDoneToast = Toast.makeText(this, "All done!", Toast.LENGTH.LONG); ^ symbol: variable LENGTH location: class Toast 1 error

alex lewis
alex lewis
1,324 Points

so, i retyped it and it's exactly the same as what i put before and it works now.... not sure what happened.

alex lewis
alex lewis
1,324 Points

in the last code i posted, length long should have an underscore, not a period.

aaron joseph
aaron joseph
1,294 Points

make one of the answers a best answer