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 showLongToastTop(Context context, int resId) {
    Toast toast = Toast.makeText(context, resId, Toast.LENGTH_LONG);
    toast.setGravity(Gravity.TOP, 0, 100);
    TextView v = toast.getView().findViewById(android.R.id.message);
    if (v != null)
        v.setGravity(Gravity.CENTER);//from   ww w.j  a  v  a2 s.c  om
    toast.show();
}

From source file:Main.java

public static void ShowToast(Activity activity, String str, boolean isLong) {
    if (isLong) {
        Toast.makeText(activity, str, Toast.LENGTH_LONG).show();
    } else {/*ww w  .  j  a  va2s  .c  o  m*/
        Toast.makeText(activity, str, Toast.LENGTH_SHORT).show();
    }
}

From source file:Main.java

/**
 * shows a short message on top of your app... it goes away automatically after a long delay
 *//*www.  j ava 2s . c o  m*/
public static void showToastLong(Activity a, String msg) {
    Toast.makeText(a, msg, Toast.LENGTH_LONG).show();
}

From source file:Main.java

public static void showToast(Context context, String text) {
    Toast t = Toast.makeText(context, text, Toast.LENGTH_LONG);
    t.setGravity(Gravity.CENTER, 0, 0);/*www . java2  s.co m*/
    t.show();
}

From source file:Main.java

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

From source file:Main.java

public static void showToast(Activity activity, String msg) {
    String s = String.format("animator: %s", msg);
    Toast.makeText(activity, s, Toast.LENGTH_LONG).show();
}

From source file:Main.java

public static void showToast_Long(Context context, String text) {
    Toast toast = Toast.makeText(context, text, Toast.LENGTH_LONG);
    toast.setGravity(Gravity.CENTER, 0, 0);
    toast.show();/*from  w  w  w  . ja va 2s  .  c om*/
}

From source file:Main.java

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

From source file:Main.java

/**
 * General Purpose Toast*///w  ww  .j  a va2  s.c  o  m
public static void showToast(Context context, String message) {
    Toast.makeText(context, message, Toast.LENGTH_LONG).show();
}

From source file:Main.java

public static void show(String msg, Context context) {
    if (toast == null) {
        toast = Toast.makeText(context, msg, Toast.LENGTH_LONG);
    }/*from ww  w.  jav  a  2 s  .com*/
    toast.setText(msg);
    toast.show();
}