List of usage examples for android.widget Toast makeText
public static Toast makeText(Context context, @StringRes int resId, @Duration int duration) throws Resources.NotFoundException
From source file:Main.java
public static void showShortToastBottom(Context context, int resId) { Toast toast = Toast.makeText(context, resId, Toast.LENGTH_SHORT); TextView v = toast.getView().findViewById(android.R.id.message); if (v != null) v.setGravity(Gravity.CENTER);//from ww w . j a va2s .c om toast.show(); }
From source file:Main.java
public static void ToastMessage(Context cont, String msg) { if (cont == null || msg == null) { return;//www. j a v a 2 s .c o m } Toast.makeText(cont, msg, Toast.LENGTH_SHORT).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);//from w w w . j ava2 s . co m t.show(); }
From source file:Main.java
public static Toast showToast(Context context, String msg, int length) { if (toast == null) { toast = Toast.makeText(context, msg, length); } else {// www . j av a 2 s . co m toast.setText(msg); } return toast; }
From source file:Main.java
public static void ToastLong(Context context, String message) { toast = Toast.makeText(context, message, Toast.LENGTH_LONG); toast.show(); }
From source file:Main.java
public static void makeToastMsg(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 av a 2 s .co m }
From source file:Main.java
public static void ToastShort(Context context, String message) { toast = Toast.makeText(context, message, Toast.LENGTH_SHORT); toast.show(); }
From source file:Main.java
public static void showLong(Context context, CharSequence message) { if (showToast) Toast.makeText(context, message, Toast.LENGTH_LONG).show(); }
From source file:Main.java
public static void show(final Activity activity, final String text) { if ("main".equalsIgnoreCase(Thread.currentThread().getName())) { Toast.makeText(activity, text, Toast.LENGTH_SHORT).show(); } else {// w w w . j a v a2 s. c o m activity.runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(activity, text, Toast.LENGTH_SHORT).show(); } }); } }
From source file:Main.java
/** * General Purpose Toast*///from w ww.j a va2s . c o m public static void showToast(Context context, String message) { Toast.makeText(context, message, Toast.LENGTH_LONG).show(); }