Display a Toast Message in Android

| Wednesday, September 24, 2014
Toast is used to display the message in small popup over the background activity. This message disappears after some time as per the duration specified in the Toast call.

Following is the syntax used for displaying the Toast Message on Android device.

 Toast.makeText(context, text, duration).show();  

This method takes 3 parameters

  1. Application Context
  2. Text Message
  3. Duration of the Toast


 Toast.makeText(login.this, "Username required", Toast.LENGTH_LONG).show();  


Post a Comment

Next Prev