Example usage for android.widget Toast LENGTH_SHORT

List of usage examples for android.widget Toast LENGTH_SHORT

Introduction

In this page you can find the example usage for android.widget Toast LENGTH_SHORT.

Prototype

int LENGTH_SHORT

To view the source code for android.widget Toast LENGTH_SHORT.

Click Source Link

Document

Show the view or text notification for a short period of time.

Usage

From source file:Main.java

/**
 * Shows a short toast//from w w w  .  j a v a2s .c o m
 *
 * @param context: The current context
 * @param msg: The toast's message
 */
public static void showShortToast(Context context, CharSequence msg) {
    Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
}

From source file:Main.java

public static void alertToast(Context context, String text) {
    Toast.makeText(context, text, Toast.LENGTH_SHORT).show();
}

From source file:Main.java

public static void mMakeTextToast(Activity activity, String str, boolean isLong) {
    if (isLong == true) {
        Toast.makeText(activity, str, Toast.LENGTH_LONG).show();
    } else {//from   w w w  .j a  v a2s  .c om
        Toast.makeText(activity, str, Toast.LENGTH_SHORT).show();
    }
}

From source file:Main.java

public static void showShort(Context context, String message) {
    Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
}

From source file:Main.java

public static void showToast(Activity context, int message) {
    Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
}

From source file:Main.java

public static void showToastMessage(String msg, Context context) {
    Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
}

From source file:Main.java

/**
 * Toast/* www  .  ja  v a 2s  .  co m*/
 * @param context
 * @param msg
 */
public static void showToast(Context context, String msg) {
    if (!TextUtils.isEmpty(msg)) {
        Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
    }
}

From source file:Main.java

public static void makeTextAndShow(Context context, int resId) {
    Toast.makeText(context, resId, Toast.LENGTH_SHORT).show();
}

From source file:Main.java

public static void toastS(Context context, int msgRes) {
    toast(context, msgRes, Toast.LENGTH_SHORT);
}

From source file:Main.java

public static void toast(Context c, String msg) {
    if (s_toast != null) {
        s_toast.cancel();/* ww  w  .ja v a2 s  . c om*/
    }
    s_toast = Toast.makeText(c, msg, Toast.LENGTH_SHORT);
    s_toast.show();
}