<font class="popmake-631">Subscribe</font>Subscribe with Androidlift to get new post on mail.

Android Toast Example

Android Toast Example

Andorid Toast can be used to display information for the short period of time. A toast contains message to be displayed quickly and disappears after sometime.

A toast provides simple feedback about an operation in a small popup. It only fills the amount of space required for the message and the current activity remains visible and interactive.

The android.widget.Toast class is the subclass of java.lang.Object class.

Toast class

Toast class is used to show notification for a particular interval of time. After sometime it disappears. It doesn’t block the user interaction.

Constants of Toast class

There are only 2 constants of Toast class which are given below.

Constant Description
public static final int LENGTH_LONG displays view for the long duration of time.
public static final int LENGTH_SHORT displays view for the short duration of time.

Android Toast Example :

Create project in Android Studio as ToastExample.





Output :


Now run project. and Enjoy…

Best luck…!