display toast in android example

Hello Guys. Welcome to our new tutorial of display toast in android example. android toast mostly use to display any information of message for a short period of time and disappears after some time.

please follow the code given below to display the android toast activity.

  • First Create a new project in Android Studio
  • File ⇒ New Android ⇒ Application Project
  • Then Open src -> package -> MainActivity.java and then add following code :

JAVA (MainActivity.java)

  •  Now Open res -> layout -> activity_main.xml and then add following code :

XML (activity_main.xml)

Output:

Finally, run this project.

This is how Android toast application looks like. this is the basic toast. also, I will tell you how to create custom toast in the next article. 

toast in android example toast in android example

Leave a Reply

Your email address will not be published. Required fields are marked *