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 showToast(final Context c, final CharSequence text) { new Handler(Looper.getMainLooper()).post(new Runnable() { public void run() { if (c == null) return; Toast.makeText(c, text, Toast.LENGTH_SHORT).show(); }/* w w w. jav a 2s. co m*/ }); }
From source file:Main.java
public static void toastMessage(Context context, String text) { if (TextUtils.isEmpty(text)) { return;/*w w w . j a v a 2 s . c o m*/ } Toast.makeText(context, text, Toast.LENGTH_SHORT).show(); }
From source file:Main.java
public static void showToast(Activity activity, int stringId) { String message = activity.getString(stringId); if (message != null) { Toast.makeText(activity, message, Toast.LENGTH_SHORT).show(); }/*from w ww . ja v a 2 s . co m*/ }
From source file:Main.java
public static void makeToast(final Context context, final String text) { runInUIThread(new Runnable() { @Override//from w ww . j a v a2s . c o m public void run() { Toast.makeText(context, text, Toast.LENGTH_SHORT).show(); } }); }
From source file:Main.java
public static void showSafeToast(final Context context, final String text) { sHandler.post(new Runnable() { @Override//from w w w . jav a2 s . c om public void run() { Toast.makeText(context, text, Toast.LENGTH_SHORT).show(); } }); }
From source file:Main.java
public static void copyToClipBoard(Context context, String text, String success) { ClipData clipData = ClipData.newPlainText("gank", text); ClipboardManager manager = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); manager.setPrimaryClip(clipData);// w w w. jav a 2 s.c om Toast.makeText(context, success, Toast.LENGTH_SHORT).show(); }
From source file:Main.java
@SuppressLint("ShowToast") private static void getToast(Context context) { if (toast == null) { toast = new Toast(context); }//from ww w. j av a2 s. c o m if (view == null) { view = Toast.makeText(context, "", Toast.LENGTH_SHORT).getView(); } toast.setView(view); }
From source file:Main.java
public static void copyToClipBoard(Context context, String text, String success) { ClipData clipData = ClipData.newPlainText("keep_nice", text); ClipboardManager manager = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); manager.setPrimaryClip(clipData);//from w w w . jav a2s . c o m Toast.makeText(context, success, Toast.LENGTH_SHORT).show(); }
From source file:Main.java
public static void showToast(final Context mContext, final int resId) { sharedHandler(mContext).post(() -> { if (toast != null) { toast.setText(resId);/*from ww w .j av a 2 s . c om*/ toast.setDuration(Toast.LENGTH_SHORT); } else { toast = Toast.makeText(mContext.getApplicationContext(), resId, Toast.LENGTH_SHORT); } toast.show(); }); }
From source file:Main.java
public static void show(Context context, int resId) { if (toast == null) { toast = Toast.makeText(context, resId, Toast.LENGTH_SHORT); } else {//from w ww. j ava 2 s . c om toast.setText(resId); } toast.show(); }