From the course: Android Development Tips

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Communicate with Snackbar messages

Communicate with Snackbar messages - Android Tutorial

From the course: Android Development Tips

Communicate with Snackbar messages

- [Instructor] Nearly all Android apps have to communicate information to the user when a status changes, when an operation finishes, or perhaps when something doesn't go according to plan. The SDK includes the Toast message, a message you can trigger easily that appears independently of the current activity. I'll add a Toast message to the runCode method of this application. After I call my log method, I'll type Toast and press tab, and then I'll pass in a literal string of this is a Toast message. I'll run the app, and when I click the Run Code button, I get the Toast message. Now the Toast message can appear for any length of time. I'm currently using a constant called LENGTH_SHORT. I'll change that to LENGTH_LONG, and then I'll run the application again. And this time when I display the message, and I click the Run Code button, the message stays on the screen longer, and this gives me an opportunity to show you something interesting. I'll click the Run Code button three times, and…

Contents