Android – Text notifications (Toast)

By -

Problem: How to give alert message (text notification) to the user of the application?

Toast notification

It is known as Toast notification in Android.

  • It is non-interactive message.
  • It is used to display text notifications(message) to the user.
  • It automatically fades-in and fade-out on the surface of the window/screen.
  • It covers only the area which is required by the message.
Toast.makeText(this,"This is the Text Notification Demo", Toast.LENGTH_SHORT);

OR

   Context context = this;
   String text = "This is the Text Notification Demo";
   int duration = 1000;
   Toast.makeText(context, text, duration).show();
Paresh Mayani

Lazy android developer, exploring the horizon of android development since 7 years, currently working as a Technical Lead - Android at Simform Solutions, India. Former Application Architect at KarConnect. He is the Head/Organizer of Google Developers Group (GDG), Ahmedabad

Loading Facebook Comments ...
Loading Disqus Comments ...