Example usage for android.widget Toast LENGTH_LONG

List of usage examples for android.widget Toast LENGTH_LONG

Introduction

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

Prototype

int LENGTH_LONG

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

Click Source Link

Document

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

Usage

From source file:Main.java

private static void showToast(Context context, @StringRes int resId) {
    Toast.makeText(context, resId, Toast.LENGTH_LONG).show();
}

From source file:Main.java

/**
 * Show a toaster witht message//  ww  w.ja  v  a 2  s. com
 * @param con
 * @param message
 */
public static void showToaster(Context con, String message) {
    Toast toast = Toast.makeText(con, message, Toast.LENGTH_LONG);
    toast.show();
}

From source file:Main.java

public static void showMessage(final Activity activity, final String message) {
    activity.runOnUiThread(new Runnable() {
        public void run() {
            Toast.makeText(activity, message, Toast.LENGTH_LONG).show();
        }//from  w w  w.j a  v  a2 s  .c  om
    });
}

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;/*from   ww  w .  j  ava  2s  .  co m*/
    } else {
        duration = Toast.LENGTH_LONG;
    }
    Toast.makeText(context, text, duration).show();
}

From source file:Main.java

public static void toast(String msg, Context ctx, Boolean isShort) {
    if (isShort) {
        Toast.makeText(ctx, msg, Toast.LENGTH_SHORT).show();
    } else {//from w  w  w  .ja  v  a2  s.c  o m
        Toast.makeText(ctx, msg, Toast.LENGTH_LONG).show();
    }
}

From source file:Main.java

public static void show(Context context, int info) {
    Toast.makeText(context, info, Toast.LENGTH_LONG).show();
}

From source file:Main.java

public static void show(Context context, Integer duration) {
    if (duration == null)
        duration = Toast.LENGTH_LONG;

    for (String msg : messages) {
        Toast.makeText(context, msg, duration).show();
    }//from w ww.  ja v a 2 s.  c  om
}

From source file:Main.java

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

    if (duration == Toast.LENGTH_SHORT)
        durationInMillisecond = 2000;/*w  ww . j  a  v 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 Toast showLong(Context context, CharSequence message) {
    if (null == toast) {
        toast = Toast.makeText(context, message, Toast.LENGTH_LONG);
        // toast.setGravity(Gravity.CENTER, 0, 0);
    } else {//from   w ww  .j  ava2 s.  c o m
        toast.setText(message);
    }
    toast.show();
    return toast;
}

From source file:Main.java

public static void toastLong(Context context, int id) {
    Toast.makeText(context, id, Toast.LENGTH_LONG).show();
}