By Alvin Alexander. Last updated: January 6, 2020
Android Toast FAQ: How do I create a Toast message in Android? (Or, Can you share some Android Toast message syntax examples?)
Sure. Here’s one example of the Android Toast syntax:
Toast.makeText( ProjectActivity.this, "Your message here", Toast.LENGTH_SHORT ).show();
Here’s a second example, this time referring to the Android application context as the first method parameter:
Toast.makeText( getApplicationContext(), "Your message here", Toast.LENGTH_SHORT ).show();
There are probably other ways to create Toast messages in Android, but those are the two I use most frequently.
Android Toast links
Here are several links related to creating Toast message notifications:
I hope these Android Toast syntax examples and references have been helpful.