Android N Developer Course: D2

Day 5 of 100 days of code.

Learned about Toast today. I think its cute they call it toast because it pops up at the bottom of the screen like toast does out of the toaster.

Toast can only be Long or Short: meaning it will show up at the bottom of the screen for a short or long time. You can also use the variableName.getText().toString() to retrieve what the user entered and display it to the bottom of the screen as well as concatenate any message you want to go along with it. In this case, I added “Hi there, ” so it would display before the name retrieved.

I made a small toast program that has a TextView, a PlainText spot to enter your name, and a button that says “Click me!”.

In the MainActivity, I created an EditText variable and typecasted so the program can find it in the Resources. Here is the code to create this program and the result below!

Overall, I thought this was a neat little bit. I remember watching this video like a year ago and I didn’t think I was ever going to understand it. Well, LOOK AT ME NOW! 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s