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();

CEO & Co-Founder at SolGuruz® | Organiser @ GDG Ahmedabad | Top 0.1% over StackOverflow | 15+ years experienced Tech Consultant | Helping startups with Custom Software Development

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