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

/**
 * This method provides uniform logging functionality for given message
 * @param context//ww w.j  a va2 s.c o m
 * @param errmsg
 */
public static void handleError(Context context, String errmsg) {
    Toast.makeText(context, errmsg, Toast.LENGTH_LONG).show();
    Log.e("Yum Exception!", errmsg);
}

From source file:Main.java

@SuppressLint("ShowToast")
public static Toast createToast(Context context, String message) {
    Toast toast = Toast.makeText(context, message, Toast.LENGTH_LONG);
    toast.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL, 0, 0);
    return toast;
}

From source file:Main.java

/**
 * Shows a long toast message/*from  ww  w.ja va 2s.  co  m*/
 *
 * @param context Context that toast should be visible in
 * @param message String to be shown
 */
public static void showToastLong(Context context, String message) {
    Toast.makeText(context, message, Toast.LENGTH_LONG).show();
}

From source file:Main.java

/**
 * Function to display toast message to user
 *
 * @param context:context of the activity
 * @param msg:message     to display to the user
 *///  ww w.j a  v a  2 s.c o  m
public static void displayToast(Context context, String msg) {
    Toast.makeText(context, msg, Toast.LENGTH_LONG).show();

}

From source file:Main.java

public static void makeToast(Context ctx, String text, boolean length_long) {
    /*/*from   ww w .  j av  a 2s .  c  o m*/
     * Run a toast; long / short depending on boolean
     */
    if (length_long) {
        Toast.makeText(ctx, text, Toast.LENGTH_LONG).show();
    } else {
        Toast.makeText(ctx, text, Toast.LENGTH_SHORT).show();
    }

}

From source file:Main.java

/**
 * Shows long toast message on screen//  ww  w.j  a  v a2 s  . c  o m
 */
public final static void showToastMessage(CharSequence message, Boolean durationLong, Context activityContext) {
    Toast toast;
    int duration;

    if (durationLong) {
        duration = Toast.LENGTH_LONG;
    } else {
        duration = Toast.LENGTH_SHORT;
    }

    toast = Toast.makeText(activityContext, message, duration);
    toast.show();
}

From source file:Main.java

public static void ShowToast(Context context, String strMsg) {
    Toast toast = Toast.makeText(context, strMsg, Toast.LENGTH_LONG);
    toast.setGravity(Gravity.CENTER, 0, 0);
    toast.setDuration(1000);/*w ww . java2s  . c o  m*/
    toast.show();
}

From source file:Main.java

public static void showPopup(final String msg, final Context context) {
    Activity a = (Activity) context;/*w w  w.  ja v  a  2s .  c  o m*/
    a.runOnUiThread(new Runnable() {
        @Override
        public void run() {
            Toast.makeText(context, msg, Toast.LENGTH_LONG).show();
        }
    });
}

From source file:Main.java

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

From source file:Main.java

public static void raiseToastAlertRunningOnUIThread(final String message, final Activity activity) {
    activity.runOnUiThread(new Runnable() {
        @Override//from  w  ww.j  a  va  2s  .c om
        public void run() {
            Toast.makeText((Context) activity, message, Toast.LENGTH_LONG).show();
        }
    });
}