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

public static void showLongToast(Context mContext, CharSequence text) {
    Toast.makeText(mContext, text, Toast.LENGTH_SHORT).show();
}

From source file:Main.java

public static void toastInMiddle(Context context, String message) {
    Toast toast = Toast.makeText(context, message, Toast.LENGTH_SHORT);
    toast.setGravity(Gravity.CENTER, 0, 0);
    toast.show();// www .j  a v a 2s. c o m
}

From source file:Main.java

public static void makeToast(Context context, String text, int type) {
    int duration = 0;
    if (type == 0) {
        duration = Toast.LENGTH_SHORT;
    } else {/*from   ww w .j  ava  2 s . co  m*/
        duration = Toast.LENGTH_LONG;
    }
    Toast.makeText(context, text, duration).show();
}

From source file:Main.java

public static boolean showErrorToastCenter(Context context, String msg) {
    Toast toast = Toast.makeText(context, msg, Toast.LENGTH_SHORT);
    toast.setGravity(Gravity.CENTER, 0, 0);
    toast.show();//from w ww  .  j ava 2 s.c  om
    return false;
}

From source file:Main.java

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

From source file:Main.java

public static void showToast(String msg) {
    if (context_ != null) {
        Toast.makeText(context_, msg, Toast.LENGTH_SHORT).show();
    }
}

From source file:Main.java

public static void showMessage(Context context) {
    Toast.makeText(context, "toast from payment library again", Toast.LENGTH_SHORT).show();
}

From source file:Main.java

public static void toastShow(String msg) {
    if (myContext != null)
        Toast.makeText(myContext, msg, Toast.LENGTH_SHORT).show();
}

From source file:Main.java

/**
 *
 * @param context//w  w w .j  ava2  s. c o m
 * @param msg
 */
public static void Toast(Context context, String msg) {
    Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
}

From source file:Main.java

public static void showShortToast(Context mContext, @StringRes int resId) {
    Toast.makeText(mContext, resId, Toast.LENGTH_SHORT).show();
}