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 showToastShort(Context context, String message) {
    Toast toast = Toast.makeText(context.getApplicationContext(), message, Toast.LENGTH_SHORT);
    toast.setGravity(Gravity.CENTER, 0, 0);
    toast.show();/* w  ww.  ja  va2s. co m*/
}

From source file:Main.java

public static void displayToast(Context context, String message) {
    if (isToast) {
        Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
    }/*from   ww  w .j  a va2  s .c om*/
}

From source file:Main.java

public static void showToastView(Context context, String text) {
    Toast toast = Toast.makeText(context, text, Toast.LENGTH_SHORT);
    View view = toast.getView();//  ww  w . j  a  va 2 s .  com
    view.setBackgroundColor(Color.GREEN);
    toast.setView(view);
    toast.show();
}

From source file:Main.java

public static void showToast(Context context, String msg) {
    if (mToast == null) {
        mToast = Toast.makeText(context, msg, Toast.LENGTH_SHORT);
    } else {//from ww w.j  a va 2 s  .c  om
        mToast.setText(msg);
    }
    mToast.show();
}

From source file:Main.java

public static void showToast(Context context, String content) {
    if (toast == null)
        toast = Toast.makeText(context, content, Toast.LENGTH_SHORT);
    else/*from  w ww .  j  av a 2 s . c  o m*/
        toast.setText(content);
    toast.show();
}

From source file:Main.java

public static void ShowTips(Context context, String tips) {
    if (mToast == null) {
        mToast = Toast.makeText(context, tips, Toast.LENGTH_SHORT);
    } else {//from  w ww.  j a  v a 2  s. co m
        mToast.setText(tips);
    }
    mToast.show();
}

From source file:Main.java

public static void show(Context context, String text) {
    if (toast == null) {
        toast = Toast.makeText(context, text, Toast.LENGTH_SHORT);
    } else {//from  w  w  w.ja va  2s.co m
        toast.setText(text);
    }
    toast.show();
}

From source file:Main.java

public static void shortToast(int string, Context ctx) {
    Toast t = new Toast(ctx).makeText(ctx, string, Toast.LENGTH_SHORT);
    t.setGravity(Gravity.TOP, 0, dpToPx(55, ctx));
    t.show();//w w  w.  ja  v a  2 s . c o  m
}

From source file:Main.java

public static void showTextShort(Context context, String text) {
    if (toast == null) {
        toast = Toast.makeText(context, text, Toast.LENGTH_SHORT);
    } else {//w  w  w . j  a v a 2  s .  co m
        toast.setText(text);
        toast.setDuration(Toast.LENGTH_SHORT);
    }
    toast.show();
}

From source file:Main.java

public static void ToastMessage(Context cont, String msg) {
    if (cont == null || msg == null) {
        return;//from  w w w.  j  a va  2  s. c o  m
    }
    Toast.makeText(cont, msg, Toast.LENGTH_SHORT).show();
}