×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: Massimo Zappino
Added: Sep 10, 2012 8:44 AM
Modified: Sep 11, 2012 6:56 AM
Views: 61
http://developer.android.com/guide/topics/ui/notifiers/toasts.html
  1. Context context = getApplicationContext();
  2. CharSequence text = "Hello toast!";
  3. int duration = Toast.LENGTH_SHORT;
  4.  
  5. Toast toast = Toast.makeText(context, text, duration);
  6. toast.show();
  7.  
  8.  
  9. // short way
  10. CharSequence text = "Hello toast!";
  11. Toast.makeText(this, text, Toast.LENGTH_SHORT).show();