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 makeToastMsg(Context context, String message) {
    Toast toast = Toast.makeText(context, message, Toast.LENGTH_SHORT);
    toast.setGravity(Gravity.CENTER, 0, 0);
    toast.show();//from  w  w  w  .j  av  a  2  s. c  o  m
}

From source file:Main.java

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

From source file:Main.java

public static void getShortToast(Context context, String hint) {
    if (toast == null) {
        toast = Toast.makeText(context, hint, Toast.LENGTH_SHORT);
    } else {// w w  w  . ja  v  a2s .co m
        toast.setText(hint);
        toast.setDuration(Toast.LENGTH_SHORT);
    }
    toast.show();
}

From source file:Main.java

public static void showToast_Short(Context context, String text) {
    Toast toast = Toast.makeText(context, text, Toast.LENGTH_SHORT);
    toast.setGravity(Gravity.CENTER, 0, 0);
    toast.show();/*from  w w w  . ja  v a2 s.  c o m*/
}

From source file:Main.java

public static void alert(Context c, String message) {
    Toast.makeText(c, TAG + "-" + message, Toast.LENGTH_SHORT).show();
}

From source file:Main.java

public static Toast showShort(Context context, String showText) {
    return show(context, showText, Toast.LENGTH_SHORT);
}

From source file:Main.java

public static void showToast(String msg, boolean isShort) {

    int dur;//w w  w .j ava  2  s .co m
    if (isShort)
        dur = Toast.LENGTH_SHORT;
    else
        dur = Toast.LENGTH_LONG;
    if (toast != null)
        toast.cancel();
    toast = Toast.makeText(context, msg, dur);
    toast.show();
}

From source file:Main.java

/**
 * @param message//from   ww  w. j a  v a  2s  . com
 */
public static void showToast(int message, Toast mToast, Context context) {
    if (mToast == null) {
        mToast = Toast.makeText(context, "", Toast.LENGTH_SHORT);
    }
    mToast.setText(context.getString(message));
    mToast.show();
}

From source file:Main.java

public static void show(Context context, String info) {
    if (TextUtils.isEmpty(info))
        return;/*from ww w.j  a v  a 2s  .  c  o  m*/
    Toast.makeText(context, info, Toast.LENGTH_SHORT).show();
}

From source file:Main.java

public static void showToast(String msg, boolean isShort) {
    int dur = 0;//from ww  w  .  j  a  va 2s .  com
    if (isShort)
        dur = Toast.LENGTH_SHORT;
    else
        dur = Toast.LENGTH_LONG;
    if (toast != null)
        toast.cancel();
    toast = Toast.makeText(context, msg, dur);
    toast.show();
}