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
/** * Displays a message toast//from w w w .jav a 2s .c o m * * @param context * The context the toast is displayed * @param text * The text contained in the toast */ public static void createToast(Context context, String text) { Toast.makeText(context, text, Toast.LENGTH_LONG).show(); }
From source file:Main.java
@SuppressWarnings("ResourceType") @SuppressLint("ShowToast") public static void showToastMessage(Context context, String msg) { try {/*from w ww.j av a2 s . co m*/ if (msg != null && !msg.equalsIgnoreCase("")) { Toast.makeText(context.getApplicationContext(), msg, 4000).show(); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:Main.java
public static void Toast(Context context, String text) { Toast toast = Toast.makeText(context, text, Toast.LENGTH_LONG); toast.show(); }
From source file:Main.java
public static void showToast(final Activity activity, final String message) { activity.runOnUiThread(new Runnable() { @Override/*from w ww .j av a2 s. co m*/ public void run() { Toast toast = Toast.makeText(activity.getApplicationContext(), message, Toast.LENGTH_SHORT); toast.setGravity(Gravity.CENTER_VERTICAL | Gravity.BOTTOM, 0, 80); toast.show(); } }); }
From source file:Main.java
public static void toastMsg(Context context, int resId, int duration) { if (context != null) Toast.makeText(context, context.getResources().getString(resId), duration).show(); }
From source file:Main.java
public static void showTip(Context context, String text, boolean isInter) { if (null == showToast) { showToast = Toast.makeText(context, text, Toast.LENGTH_SHORT); } else {// w ww . jav a2 s . com if (isInter) { showToast.cancel(); showToast = Toast.makeText(context, text, Toast.LENGTH_SHORT); } else { showToast.setText(text); } } showToast.setGravity(Gravity.BOTTOM, 0, 0); showToast.show(); }
From source file:Main.java
public static void showToast(Context context, String s) { if (toast == null) { toast = Toast.makeText(context, s, Toast.LENGTH_SHORT); toast.show();/*from ww w .j ava 2s . c om*/ oneTime = System.currentTimeMillis(); } else { twoTime = System.currentTimeMillis(); if (s.equals(oldMsg)) { if (twoTime - oneTime > Toast.LENGTH_SHORT) { toast.show(); } } else { oldMsg = s; toast.setText(s); toast.show(); } } oneTime = twoTime; }
From source file:Main.java
public static void toast(Context context, String message) { if (!TextUtils.isEmpty(message)) { Toast.makeText(context, message, Toast.LENGTH_SHORT).show(); }//from w ww . j av a2 s .co m }
From source file:Main.java
public static void show(Context context, Integer duration) { if (duration == null) duration = Toast.LENGTH_LONG;/*w ww .j a v a2 s . c o m*/ for (String msg : messages) { Toast.makeText(context, msg, duration).show(); } }
From source file:Main.java
public static void showToast(String message, Context context, int duration) { if (message == null || message.length() == 0) return;//www . ja v a2 s. c o m try { Toast toast = Toast.makeText(context, message, duration); toast.setGravity(Gravity.CENTER, 0, 0); toast.show(); } catch (Exception e) { // } }