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

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