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 toast(Activity activity, final String msg) {
    Toast.makeText(activity, msg, Toast.LENGTH_SHORT).show();
}

From source file:Main.java

public static void toast(Context mcontext, String toastStr, int i) {
    Toast toast = Toast.makeText(mcontext, toastStr, Toast.LENGTH_SHORT);
    toast.setGravity(i, 0, 0);//Gravity.CENTER
    toast.show();/*from   ww w  .  jav  a  2  s. c  o  m*/
}

From source file:Main.java

public static void showTips(Context ctx, String msg) {
    int duration = Toast.LENGTH_SHORT;
    Toast toast = Toast.makeText(ctx, msg, duration);
    toast.show();//from w  ww.j av a 2s .  c o m
}

From source file:Main.java

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

From source file:Main.java

private static void showToast(int messageId) {
    Toast.makeText(mContext, messageId, Toast.LENGTH_SHORT).show();
}

From source file:Main.java

private static Toast getToast(Context context) {
    return Toast.makeText(context, "", Toast.LENGTH_SHORT);
}

From source file:Main.java

public static void waitForPreviousToastDismiss(int duration) throws InterruptedException {
    int durationInMillisecond;

    if (duration == Toast.LENGTH_SHORT)
        durationInMillisecond = 2000;//from  w ww  . j av  a  2s. c  o  m
    else if (duration == Toast.LENGTH_LONG)
        durationInMillisecond = 3500;
    else
        durationInMillisecond = duration;

    Thread.sleep(durationInMillisecond);
}

From source file:Main.java

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

From source file:Main.java

public static void showToast(String message, Context context) {
    int duration = Toast.LENGTH_SHORT;
    Toast toast = Toast.makeText(context, message, duration);
    toast.show();// w  ww  .  ja  v a 2  s  .co  m
}

From source file:Main.java

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