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

Jamil Baba
Jamil Baba
570 Points

Set the Toast variable using the static makeText() method of the Toast class. Use the this keyword for the first paramet

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

ToastTest.java
Toast allDoneToast.makeText(this,"All done",Toast.LENGTH_LONG);

1 Answer

Hello,

You want to be calling static makeToast() method of the Toast class and then save that result to the variable allDoneToast. To call a static method of a class you do it like:

Class.method(param1, param2);

Where Class is the class the method belongs to and method is the method you want to call.