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

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

From source file:Main.java

public static void showLong(Context context, String message) {
    Toast.makeText(context, message, Toast.LENGTH_LONG).show();
}

From source file:Main.java

/**
 * Shows a long toast// w  w  w.  j  a v  a2 s  .  c  o m
 *
 * @param context: The current context
 * @param msg: The toast's message
 */
public static void showLongToast(Context context, CharSequence msg) {
    Toast.makeText(context, msg, Toast.LENGTH_LONG).show();
}

From source file:Main.java

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

    int dur;/*from   w w w.ja  v  a 2 s.  c o  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

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

From source file:Main.java

public static void showToast(String msg, boolean isShort) {
    int dur = 0;//from w w w  .j  ava 2 s.c  o 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

public static void toastL(Context context, int msgRes) {
    toast(context, msgRes, Toast.LENGTH_LONG);
}

From source file:Main.java

public static void toast(Context context, final String msg) {
    try {/*from   ww  w .ja v  a 2s.c  om*/
        Toast.makeText(context, msg, Toast.LENGTH_LONG).show();
        Log.d(TAG, "toast: " + msg);
    } catch (Exception e) {
        Log.d(TAG, "Couldn't display toast: " + msg + " / " + e.toString());
    }
}

From source file:Main.java

public static void showLong(Context context, String msg) {
    if (context != null && !TextUtils.isEmpty(msg)) {
        Toast.makeText(context.getApplicationContext(), msg, Toast.LENGTH_LONG).show();
    }/*from   w w  w .  ja v  a2  s .c om*/
}

From source file:Main.java

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