CRTC Electronics

Click here to edit subtitle


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. For example, navigating away from an email before you send it triggers a "Draft saved" toast to let you know that you can continue editing later. Toasts automatically disappear after a timeout.

Here is a method called toast. This method takes a string parameter as the message like "hi, this is a message". Now when you call toast it displays immediately.


toast("Hi, this is a message");

you can set the duration of the toast to  


private void toast(final String message) 


   final Context context = this;



      new Runnable() 



         public void run() 


            Toast.makeText(context, message, Toast.LENGTH_LONG).show();