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
public static void show(Context context, int info, boolean longtoast) { if (longtoast) { Toast.makeText(context, info, Toast.LENGTH_LONG).show(); } else {//from w w w. jav a 2 s . co m Toast.makeText(context, info, Toast.LENGTH_SHORT).show(); } }
From source file:Main.java
public static void callGoogleTranslateApps(Context context, String word, String toLang) { try {/* ww w .j av a 2s. c o m*/ Intent i = new Intent(); i.setAction(Intent.ACTION_VIEW); i.putExtra("key_text_input", word); i.putExtra("key_text_output", ""); i.putExtra("key_language_from", "en"); i.putExtra("key_language_to", "vi"); i.putExtra("key_suggest_translation", ""); i.putExtra("key_from_floating_window", false); i.setComponent(new ComponentName("com.google.android.apps.translate", "com.google.android.apps.translate.TranslateActivity")); context.startActivity(i); } catch (ActivityNotFoundException ex) { Toast.makeText(context, "Google translate app is not installed", Toast.LENGTH_SHORT).show(); ex.printStackTrace(); } }
From source file:Main.java
/** Makes a short toast */ public static void shortToast(String message, Context context) { CharSequence text = message;/*from w w w. j a v a 2 s . c om*/ int duration = Toast.LENGTH_SHORT; Toast toast = Toast.makeText(context, text, duration); toast.show(); }
From source file:Main.java
public static void showShortToast(final Context context, final int resId) { Toast toast = Toast.makeText(context, resId, Toast.LENGTH_SHORT); toast.show();//from w ww .java 2s . c o m }
From source file:Main.java
private static synchronized void createToast(Context context) { if (sToast == null) { sToast = Toast.makeText(context.getApplicationContext(), "", Toast.LENGTH_SHORT); }/*from ww w. j ava 2 s . c o m*/ }
From source file:Main.java
public static void toast(Context context, String msg) { toast(context, msg, Toast.LENGTH_SHORT); }
From source file:Main.java
public static void show(Context context, CharSequence text) { if (!TextUtils.isEmpty(text)) { if (text.length() < 10) { Toast.makeText(context, text, Toast.LENGTH_SHORT).show(); } else {//from w ww . jav a2 s .c o m Toast.makeText(context, text, Toast.LENGTH_LONG).show(); } } }
From source file:Main.java
public static void showToast(Context ctx, String message) { Context context = ctx;/*from w w w . ja v a2s . co m*/ int duration = Toast.LENGTH_SHORT; Toast toast = Toast.makeText(context, message, duration); toast.show(); }
From source file:Main.java
public static void makeToast(Context c, String str) { Toast.makeText(c, str, Toast.LENGTH_SHORT).show(); }
From source file:Main.java
/** * Mostra un messaggio TOAST// w ww . jav a 2s . co m */ public static void showToast(Context context, String message) { Toast.makeText(context, message, Toast.LENGTH_SHORT).show(); }