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
/** * Make long toast./* w w w.ja v a 2 s . co 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
public static void toastLong(Context context, String message) { if (!TextUtils.isEmpty(message)) { Toast.makeText(context, message, Toast.LENGTH_LONG).show(); }//from ww w . jav a 2s . c om }
From source file:Main.java
public static void showToast(final String toast, final Context context) { new Thread(new Runnable() { @Override/* w w w .j av a2 s . c om*/ public void run() { Looper.prepare(); Toast.makeText(context, toast, Toast.LENGTH_SHORT).show(); Looper.loop(); } }).start(); }
From source file:Main.java
public static void showToast(Context context, String text) { // TODO Auto-generated method stub Toast.makeText(context, text, Toast.LENGTH_SHORT).show(); }
From source file:Main.java
/** * Method to generate a toast.// w ww .j a v a 2 s . c o m * @param context The target context * @param content The toast content * @param duration The toast duration */ public static void toastContext(final Context context, final String content, final int duration) { Toast toast = Toast.makeText(context, content, duration); toast.show(); }
From source file:Main.java
public static void show(Context context, int info) { Toast.makeText(context, info, Toast.LENGTH_SHORT).show(); }
From source file:Main.java
public static void show(Context context, int info) { Toast t = Toast.makeText(context, info, Toast.LENGTH_LONG); t.setGravity(Gravity.CENTER, 0, 0);/* w w w . j a va 2 s .co m*/ t.show(); }
From source file:Main.java
public static boolean checkCameraHardware(Context context) { if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA)) { return true; } else {/*from w ww. ja va2 s . co m*/ Toast.makeText(context, "No camera on this device", Toast.LENGTH_SHORT).show(); return false; } }
From source file:Main.java
public static void showMessage(Context context, String message) { if (context != null) { Toast.makeText(context, message, Toast.LENGTH_LONG).show(); }/*from w w w.j a va 2s . c om*/ }
From source file:Main.java
/** * Shows toast for short duration/*from w w w . j a v a 2 s.c o m*/ */ public static void toastShort(Context context, String msg) { if (context == null) return; if (toastShort != null) toastShort.cancel(); toastShort = Toast.makeText(context, msg, Toast.LENGTH_SHORT); toastShort.show(); }