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 trialMaksims Visnakovs
2,616 PointsBuild a Simple Android App
Hi there. I have difficulty in solving the Toast problem. in task 3 out of three I have to add a Second toast which I have create out of two lines I have created in two previous tasks and make it a one line. I don't really understand how is this possible and can't think about a solution due to my limited JAVA knowledge. If someone knows the answer will be appreciated.
Toast allDoneToast = Toast.makeText(this,"All done!",Toast.LENGTH_LONG);
Toast.makeText(this,"All done!",Toast.LENGTH_LONG).show();
Toast allToast = Toast.makeText(this,"Great!",Toast.LENGTH_LONG).show();
1 Answer
Kevin Faust
15,353 PointsThis is the first part which I believe you got:
Toast allDoneToast = Toast.makeText(this, "All done!", Toast.LENGTH_LONG);
allDoneToast.show();
For the last challenge, you dont create a variable for your toast but rather just create a toast and display it.
Toast.makeText(this, "All done!", Toast.LENGTH_LONG).show();
You got it correct in your code on the second line. Your third line won't work because you cant show a toast and store it as a variable. Only if you dont show it then it would work