List of usage examples for android.widget Toast setGravity
public void setGravity(int gravity, int xOffset, int yOffset)
From source file:Main.java
public static void showToast_Long(Context context, String text) { Toast toast = Toast.makeText(context, text, Toast.LENGTH_LONG); toast.setGravity(Gravity.CENTER, 0, 0); toast.show();/*ww w . j a va 2 s. co m*/ }
From source file:Main.java
public static void ShowToast(Context context, String message) { Toast msg = Toast.makeText(context, message, Toast.LENGTH_SHORT); msg.setGravity(Gravity.CENTER, msg.getXOffset() / 2, msg.getYOffset() / 2); msg.show();//from www . java 2 s . co m }
From source file:Main.java
public static void toast(String message, Context context) { Toast msg = Toast.makeText(context, message, Toast.LENGTH_LONG); msg.setGravity(Gravity.CENTER, msg.getXOffset() / 2, msg.getYOffset() / 2); msg.show();/* w w w .j a v a 2s .c om*/ }
From source file:Main.java
/***************************************************************************** * Function: serviceToast//from w w w . j a v a2 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_Short(Context context, String text) { Toast toast = Toast.makeText(context, text, Toast.LENGTH_SHORT); toast.setGravity(Gravity.CENTER, 0, 0); toast.show();//from w w w.ja va 2 s. co m }
From source file:Main.java
public static boolean showErrorToastCenter(Context context, String msg) { Toast toast = Toast.makeText(context, msg, Toast.LENGTH_SHORT); toast.setGravity(Gravity.CENTER, 0, 0); toast.show();/* www. ja v a2s .c o m*/ return false; }
From source file:Main.java
public static void infoAlert(Activity activity, String msg) { Toast toast = Toast.makeText(activity, msg, Toast.LENGTH_SHORT); toast.setGravity(Gravity.CENTER, 0, 0); toast.show();//from w w w. jav a2 s. co m }
From source file:Main.java
public static void showLongToast(Context context, String string) { Toast toast = Toast.makeText(context, string, Toast.LENGTH_LONG); toast.setGravity(Gravity.CENTER, 0, 0); toast.show();/*from ww w. ja v a 2s. co m*/ }
From source file:Main.java
public static void showToast(Context context, String string) { Toast toast = Toast.makeText(context, string, Toast.LENGTH_SHORT); toast.setGravity(Gravity.CENTER, 0, 0); toast.show();// www . ja v a 2s. co m }
From source file:Main.java
public static void showHint(final Context c, String hintText, boolean makeItAQuickOne) { int duration = makeItAQuickOne ? Toast.LENGTH_SHORT : Toast.LENGTH_LONG; Toast t = Toast.makeText(c, hintText, duration); t.setGravity(Gravity.CENTER_VERTICAL, 0, 0); t.show();//from www. j a v a 2 s .c om }