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 trialMit Sengupta
13,823 PointsCan anyone please help me sorting out what is wrong here?
I just did how it was up on the video, the same way.
Toast.makeText(this, "All done!", Toast.LENGTH_LONG).show();
1 Answer
Nicolas Hampton
44,638 PointsThat could be perfect, but what is this inside? The first parameter is this, which is the context. If "this" isn't enough to get to the correct context, you may need more detail, such as the class name of the activity (MainActivity.class) or a different context. This happens a lot when the context you're in is an anonymous class, such as a Callback or an OnClickListener.
Nicolas Hampton
44,638 PointsNicolas Hampton
44,638 PointsI also noticed that this is a treehouse test. Is the text you are supposed to toast exactly the same as they ask for in the question, capitalization and punctuation included?
Mit Sengupta
13,823 PointsMit Sengupta
13,823 PointsThanks for your answer. I have just figured it out and it's solved now. They want us do the static method first and then the one line code.