This course will be retired on June 1, 2025.
Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
In Android, a "Toast Notification" is a message that pops up on the screen for a limited time. They’re easy to use while developing to quickly check a value or something else about the app, as well as display non-essential information to the user. In this video we'll see how we can write one line of code to display some text in a Toast.
Things to Consider
Context - In Android, the Context is the current state of the application (or object). It's important because oftentimes an object or method needs to know about the state of the application to behave appropriately. It would be awfully hard to decide what to wear if you didn't know what country you we're in! In an Activity, the context can usually be represented using the this keyword. Since this refers to the current class (which is an Activity), and Activities are children (a subclass) of the Context class, that means that wherever we see a Context we can use an Activity instead.
Constants - In Java, a constant is a value that does not change. Using constants makes things easier to read and maintain and provides consistency when used in multiple places.
Related Links
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up