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 makeShortToast(Context ctx, String message) { if (ctx != null && message != null) { Toast toast = Toast.makeText(ctx, message, Toast.LENGTH_SHORT); toast.setGravity(Gravity.CENTER, 0, 50); toast.show();/*from www .j av a 2s . co m*/ } }
From source file:Main.java
public static void showToast(Context context, String message) { Toast toast = Toast.makeText(context, message, Toast.LENGTH_SHORT); toast.setGravity(Gravity.CENTER, 0, 0); toast.show();/*from w w w.j a v a 2s. co m*/ }
From source file:Main.java
public static void toastMsg(String msg, Context con) { Toast toast = Toast.makeText(con.getApplicationContext(), msg, Toast.LENGTH_LONG); toast.setGravity(Gravity.TOP, 0, 80); toast.show();/*from w w w .j a va 2s . c o m*/ }
From source file:Main.java
public static void DisplayToast(Context context, String text) { Toast toast; toast = Toast.makeText(context, text, Toast.LENGTH_SHORT); toast.setGravity(Gravity.CENTER, 0, 0); toast.show();/* w w w .java 2 s. co m*/ }
From source file:Main.java
/** * Make long toast./*from w w w. j a v a 2 s .c o m*/ * * @param ctx the ctx * @param message the message */ public static void makeLongToast(Context ctx, String message) { if (ctx != null && message != null) { Toast toast = Toast.makeText(ctx, message, Toast.LENGTH_LONG); toast.setGravity(Gravity.CENTER, 0, 50); toast.show(); } }
From source file:Main.java
/**Toast dialog with string */ public static void showToast(final String message, final Activity activity) { final Toast toast = Toast.makeText(activity, message, Toast.LENGTH_LONG); toast.setGravity(Gravity.BOTTOM, 0, 0); toast.show();//from ww w.j a v a2s. com }
From source file:Main.java
public static void showLToast(Context context, int resId) { Toast toast = Toast.makeText(context, resId, Toast.LENGTH_LONG); ;/*from ww w . j av a2 s. c om*/ toast.setGravity(Gravity.CENTER, 0, 0); toast.show(); }
From source file:Main.java
public static void showMessage(Context context, String msg) { Toast toast = Toast.makeText(context.getApplicationContext(), msg, Toast.LENGTH_LONG); toast.setGravity(Gravity.CENTER, 0, 0); toast.show();//from w w w .j a v a 2 s .c o m }
From source file:Main.java
public static void showToast(String message, Context context, int duration) { if (message == null || message.length() == 0) return;/* w w w . ja v a2 s . co m*/ try { Toast toast = Toast.makeText(context, message, duration); toast.setGravity(Gravity.CENTER, 0, 0); toast.show(); } catch (Exception e) { // } }
From source file:Main.java
public static void showToast(Context context, View view) { Toast toast = new Toast(context); toast.setView(view);//from w ww. j a v a 2s. co m toast.setGravity(Gravity.CENTER, 0, 0); toast.setDuration(Toast.LENGTH_LONG); toast.show(); }