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

private static Toast getToast(Context context) {
    return Toast.makeText(context, "", Toast.LENGTH_SHORT);
}

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

public static void toastMsg(String msg, Context con) {
    Toast toast = Toast.makeText(con.getApplicationContext(), msg, Toast.LENGTH_LONG);
    toast.setGravity(Gravity.TOP, 0, 80);
    toast.show();//  w  ww. ja v  a  2  s. c  o  m
}

From source file:Main.java

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

From source file:Main.java

public static void toastShort(Context context, int text) {
    Toast.makeText(context, text, Toast.LENGTH_SHORT).show();
}

From source file:Main.java

public static void showToast(Activity activity, String message) {
    if (activity != null) {
        Toast.makeText(activity, message, Toast.LENGTH_SHORT).show();
    }//w  w  w.j  av a2s  . co m
}

From source file:Main.java

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

From source file:Main.java

public static void showToast(Context c, String str) {
    Toast toast = Toast.makeText(c, str, Toast.LENGTH_LONG);
    toast.setGravity(Gravity.CENTER, toast.getXOffset() / 2, toast.getYOffset() / 2);
    toast.show();//from  ww w .j av a2  s . c om
}