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 makeToast(Context ctx, String text, boolean length_long) { /*// ww w.j av a2 s .c o m * Run a toast; long / short depending on boolean */ if (length_long) { Toast.makeText(ctx, text, Toast.LENGTH_LONG).show(); } else { Toast.makeText(ctx, text, Toast.LENGTH_SHORT).show(); } }
From source file:Main.java
public static void ShowToast(Context context, String strMsg) { Toast toast = Toast.makeText(context, strMsg, Toast.LENGTH_LONG); toast.setGravity(Gravity.CENTER, 0, 0); toast.setDuration(1000);/*w w w .j a v a 2s .c o m*/ toast.show(); }
From source file:Main.java
/** * Shows a short toast display//w ww . j a v a 2s . co m * * @param ctx application context * @param message message to display */ public static void showToast(Context ctx, String message) { Toast toast = Toast.makeText(ctx, message, Toast.LENGTH_SHORT); toast.setGravity(Gravity.CENTER, 0, 0); toast.show(); }
From source file:Main.java
public static void raiseToastAlertRunningOnUIThread(final String message, final Activity activity) { activity.runOnUiThread(new Runnable() { @Override//from w w w.j a v a 2 s . com public void run() { Toast.makeText((Context) activity, message, Toast.LENGTH_LONG).show(); } }); }
From source file:Main.java
public static Toast showToast(Context context, String textMessage, int timeDuration) { if (null == context) { return null; }//w w w . j ava 2 s . c o m textMessage = (null == textMessage ? "Oops! " : textMessage.trim()); Toast t = Toast.makeText(context, textMessage, timeDuration); t.show(); return t; }
From source file:Main.java
public static void showToast(Context context, String text, int duration) { if (mToast != null) mToast.setText(text);//from w w w. j av a 2 s .co m else mToast = Toast.makeText(context, text, duration); mToast.show(); }
From source file:Main.java
public static void show(String text) { if (sToast == null) { sToast = Toast.makeText(sContext, text, Toast.LENGTH_SHORT); } else {/*from www . ja va 2 s . c o m*/ sToast.setText(text); } sToast.show(); }
From source file:Main.java
public static void showToast(Context context, String toastStr) { if ((g_Toast == null) || (g_Toast.getView().getWindowVisibility() != View.VISIBLE)) { g_Toast = Toast.makeText(context, toastStr, Toast.LENGTH_SHORT); g_Toast.show();// ww w . jav a2s . c o m } return; }
From source file:Main.java
public static void showPopup(final String msg, final Context context) { Activity a = (Activity) context;/*from w ww . j ava 2 s . c o m*/ a.runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(context, msg, Toast.LENGTH_LONG).show(); } }); }
From source file:Main.java
public static void toast(Context context, CharSequence text, int duration) { Toast.makeText(context, text, duration).show(); }