List of usage examples for android.widget Toast show
public void show()
From source file:Main.java
public static void showShortToast(final Context context, final String message) { Toast toast = Toast.makeText(context, message, Toast.LENGTH_SHORT); toast.show(); }
From source file:Main.java
public static void displayToast(final Activity activity, final String text, final int duration) { activity.runOnUiThread(new Runnable() { public void run() { Toast toast = Toast.makeText(activity, text, duration); toast.show(); }// ww w . java2 s . c o m }); }
From source file:Main.java
/** * Helper for creating toasts. You could call it a toaster. *//* w ww . j a va 2s .c om*/ public static void popToast(Context context, CharSequence text) { int duration = Toast.LENGTH_LONG; Toast toast = Toast.makeText(context, text, duration); toast.show(); }
From source file:Main.java
public static void showToast(Context context, String text) { Toast t = Toast.makeText(context, text, Toast.LENGTH_LONG); t.setGravity(Gravity.CENTER, 0, 0);/*w w w . jav a 2 s . c o m*/ t.show(); }
From source file:Main.java
public static Toast showToast(Context context, String textMessage, int timeDuration) { if (context == null) { return null; }//ww w . j a v a 2s .c om Toast t = Toast.makeText(context, textMessage == null ? "Oops! " : textMessage.trim(), timeDuration); t.show(); return t; }
From source file:Main.java
public static void showMiddleToast(Context cxt, String msg) { Toast toast = Toast.makeText(cxt, msg, Toast.LENGTH_SHORT); toast.setGravity(Gravity.CENTER, 0, 0); toast.show(); }
From source file:Main.java
public static void show(Context context, String info) { Toast t = Toast.makeText(context, info, Toast.LENGTH_LONG); t.setGravity(Gravity.CENTER, 0, 0);/*from w ww .j a v a 2 s . com*/ t.show(); }
From source file:Main.java
public static void show(Context context, int info) { Toast t = Toast.makeText(context, info, Toast.LENGTH_LONG); t.setGravity(Gravity.CENTER, 0, 0);/*from w w w .j a v a2 s . c o m*/ t.show(); }
From source file:Main.java
/***************************************************************************** * Function: serviceToast/*from ww w. j a va 2 s. c o m*/ * Date March 5, 2015 * Revision: * * Designer: Jeff Bayntun * *Programmer: Jeff Bayntun * *Interface: void serviceToast(Context c, String text, int duration) * Activity c -- Current activity * String text -- toast text * int duration -- duration of the toast * *Returns: * void * * Notes: * Creates a toast on the screen. **************************************************************************/ public static void serviceToast(Context c, String text, int duration) { Toast t = Toast.makeText(c, text, duration); t.setGravity(Gravity.CENTER, 0, 0); t.show(); }
From source file:Main.java
public static void showToast(Context context, int resId, int time) { Toast toast = Toast.makeText(context, resId, time); toast.setGravity(Gravity.CENTER, 0, 0); toast.show(); }