Example usage for android.widget Toast makeText

List of usage examples for android.widget Toast makeText

Introduction

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

Prototype

public static Toast makeText(Context context, @StringRes int resId, @Duration int duration)
        throws Resources.NotFoundException 

Source Link

Document

Make a standard toast that just contains a text view with the text from a resource.

Usage

From source file:Main.java

public static void show(Context context, String info) {
    Toast t = Toast.makeText(context, info, Toast.LENGTH_LONG);
    t.setGravity(Gravity.CENTER, 0, 0);
    t.show();
}

From source file:Main.java

public static void show(Context activity, String string) {
    Toast.makeText(activity, string, Toast.LENGTH_SHORT).show();

}

From source file:Main.java

public static Toast toast(String msg) {
    Toast toast = Toast.makeText(context, msg, Toast.LENGTH_SHORT);
    toast.show();
    return toast;
}

From source file:Main.java

public static void showToast(Context context, String str) {
    Toast.makeText(context, str, Toast.LENGTH_SHORT).show();
}

From source file:Main.java

public static void showWrongAPIVersion(Context context) {
    Toast.makeText(context, "Not avaible on this API", Toast.LENGTH_SHORT).show();
}

From source file:Main.java

public static void makeToast(Context context, String msg) {
    Toast.makeText(context, msg, Toast.LENGTH_SHORT).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 a  2s.  com*/
        Toast.makeText(ctx, msg, Toast.LENGTH_LONG).show();
    }
}

From source file:Main.java

public static void toast(Activity activity, String txt) {
    Toast toast = Toast.makeText(activity, txt, Toast.LENGTH_SHORT);
    int xoffset = 30, yoffset = 30;
    toast.setGravity(Gravity.RIGHT, xoffset, yoffset);
    toast.show();//from  w  w w  .ja  va2  s  . com
}

From source file:Main.java

public static void displayMessage(Context context, String message, int length) {
    try {/*w ww.ja  v a 2 s.c  om*/
        Toast.makeText(context, message, length).show();
    } catch (Exception e) {
    }
}

From source file:Main.java

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