List of usage examples for android.widget Toast LENGTH_SHORT
int LENGTH_SHORT
To view the source code for android.widget Toast LENGTH_SHORT.
Click Source Link
From source file:Main.java
/** * Toast//from ww w. j ava2 s . c o m * * @param mContext * @param text */ public static void sendToast(Context mContext, String text) { Toast.makeText(mContext, text, Toast.LENGTH_SHORT).show(); }
From source file:Main.java
public static void showToast(Context context, String msg) { if (msg == null || msg.equals("") || msg.length() == 0) return;//from w w w . j a va 2s .com Toast.makeText(context, msg, Toast.LENGTH_SHORT).show(); }
From source file:Main.java
public static void showToast(final Activity context, final String msg) { if ("main".equals(Thread.currentThread().getName())) { Toast.makeText(context, msg, Toast.LENGTH_SHORT).show(); } else {/*from w w w . j av a 2s. c o m*/ context.runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(context, msg, Toast.LENGTH_SHORT).show(); } }); } }
From source file:Main.java
public static Toast alert(Context ctx, String message) { Toast t = Toast.makeText(ctx, message, Toast.LENGTH_SHORT); TextView v = (TextView) t.getView().findViewById(android.R.id.message); if (v != null) v.setGravity(Gravity.CENTER);/* ww w . ja va 2 s . c om*/ t.show(); return t; }
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);/*w w w .jav a 2 s . com*/ toast.show(); }
From source file:Main.java
public static void showShort(Context context, CharSequence message) { if (isShow)/* w ww. jav a 2 s . c o m*/ Toast.makeText(context, message, Toast.LENGTH_SHORT).show(); }
From source file:Main.java
/** * shows a short message on top of your app... it goes away automatically after a short delay *//*ww w.j a va2 s.co m*/ public static void showToastShort(Activity a, String msg) { Toast.makeText(a, msg, Toast.LENGTH_SHORT).show(); }
From source file:Main.java
/** shows a short message on top of your app... it goes away automatically after a short delay */ public static void showToastShort(Context a, String msg) { Toast.makeText(a, msg, Toast.LENGTH_SHORT).show(); }
From source file:Main.java
/** * Zeigt einen Toast an// ww w . j a v a2s . c om * @param text Anzuzeigender Text * @param context */ public static void showToast(String text, Context context) { int duration = Toast.LENGTH_SHORT; Toast toast = Toast.makeText(context, text, duration); toast.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 {//from www . j ava 2 s . c o m activity.runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(activity, text, Toast.LENGTH_SHORT).show(); } }); } }