Toast Notifications4:11 with Ben Deitch
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.
You need to sign up for Treehouse in order to download course files.Sign up