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 trialchandlerknaus
1,635 PointsToast allDoneToast
I cant seem to find what I am doing wrong O_o
Toast allDoneToast;
Toast.makeText(this,"All done!",Toast.LENGTH_LONG);
5 Answers
Stone Preston
42,016 Pointsthe task states: Set the Toast variable using the static makeText() method of the Toast class. Use the this keyword for the first parameter, the text "All done!" for the second parameter, and the constant Toast.LENGTH_LONG for the third parameter.
so you almost have it. you need to assign the return value of Toast.makeText to the allDoneToast variable
Toast allDoneToast = Toast.makeText(this,"All done!",Toast.LENGTH_LONG);
Daniel Hartin
18,106 PointsNothing at all, the code will run fine in an activity however if you are declaring the Toast as a variable on the line above I assume you mean to put
allDoneToast.makeText(this,"All done!",Toast.LENGTH_LONG);
p.s if it asks you to show it at the end you may need to add .show()
allDoneToast.makeText(this,"All done!",Toast.LENGTH_LONG).show()
Hope this helps
Daniel
chandlerknaus
1,635 PointsallDoneToast.makeText(this,"All done!",Toast.LENGTH_LONG); is wrong
Daniel Hartin
18,106 PointsOkay, if you post the entire class I can take a look, the code I posted above will work based on the two lines you posted as the original question.
Is this code snippet from a code challenge if so I can go in and find out what it is asking you to do?
chandlerknaus
1,635 PointsWell I have tried a ton of things and none of them work >:x
Stone Preston
42,016 Pointsdid you try my suggestion? I just tried the challenge as passed task 1 using the code I posted above. you are on task 1 correct?
chandlerknaus
1,635 Points-_- I had to take Toast allDoneToast; out.... I might need to take a break for a little lol. Thank you guys for helping :)
Omar Fiallos
1,154 PointsToast allDoneToast = Toast.makeText(this, "All done!", Toast.LENGTH_LONG);
use this..!!
Stone Preston
42,016 PointsStone Preston
42,016 Pointssee this post for instructions on posting code to the forum