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 showMessage(Context context, String msg) {
    Toast toast = Toast.makeText(context.getApplicationContext(), msg, Toast.LENGTH_LONG);
    toast.setGravity(Gravity.CENTER, 0, 0);
    toast.show();//from w  w w  . j  ava 2s  .  c  o  m
}

From source file:Main.java

public static void printError(Activity ctx, String message) {

    if (ctx != null && message != null) {
        Toast toast = Toast.makeText(ctx, message, Toast.LENGTH_LONG);
        toast.show();/*from  ww w  .  j  a v a  2 s .co  m*/
    }

}

From source file:Main.java

public static void showLongMessage(Context mContext, CharSequence text) {
    if (text != null && text.length() > 0) {
        Toast.makeText(mContext, text, Toast.LENGTH_LONG).show();
    }/*  w  w w . j a  v a 2s  .  com*/
}

From source file:Main.java

public static void ToastLong(String message, Context context) {
    // ApplicationHelper.ToastLong("", getApplicationContext());
    Toast.makeText(context, message, Toast.LENGTH_LONG).show();
}

From source file:Main.java

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

From source file:Main.java

public static void showWaningToast(Context context, String str) {
    if (context == null)
        return;//w  w  w  . j  av  a 2s  .c o  m
    try {
        Toast.makeText(context, str, Toast.LENGTH_LONG).show();
    } catch (Exception e) {
    }
}

From source file:Main.java

public static void longToast(int string, Context ctx) {
    Toast t = new Toast(ctx).makeText(ctx, string, Toast.LENGTH_LONG);
    t.setGravity(Gravity.TOP, 0, dpToPx(55, ctx));
    t.show();/*  w  ww  . j av a  2 s  .  c  om*/
}

From source file:Main.java

public static void showTips(Context context, String text) {
    if (mToast == null) {
        mToast = Toast.makeText(context, "", Toast.LENGTH_LONG);
    }//from   w  ww.j  a  v  a 2  s  . c  o m

    mToast.setText(text);
    mToast.show();
}

From source file:Main.java

public static void showTextLong(Context context, String text) {
    if (toast == null) {
        toast = Toast.makeText(context, text, Toast.LENGTH_LONG);
    } else {/*  www.jav  a  2 s .  c  om*/
        toast.setText(text);
        toast.setDuration(Toast.LENGTH_LONG);
    }
    toast.show();
}

From source file:Main.java

public static void toastGreen(Activity activity, int resId) {
    Toast toast = Toast.makeText(activity, resId, Toast.LENGTH_LONG);
    TextView v = (TextView) toast.getView().findViewById(android.R.id.message);
    v.setBackgroundColor(Color.GREEN);
    toast.show();/* ww  w  . j  a  v a  2s  .  c  o m*/

}