Android Toast

To display information for a short duration, Android Toast can be used. A message needs to be displayed quickly and to disappear after some time is included in a toast

Toast class:

To show notification for a particular interval of time which disappears after some time, the Toast class is used. 

The Toast class has only 2 constants:

Constant Uses
public static final int LENGTH_LONG To display the view for a long duration of time.
public static final int LENGTH_SHORT To display the view for a short duration of time.

Activity class displaying Toast:

Code to display the toast:

File: activity_main.xml

<?xml version=”1.0″ encoding=”utf-8″?> < xmlns:android=”” xmlns:app=”” android:layout_width=”match_parent” android:layout_height=”match_parent”