Example usage for android.widget Toast show

List of usage examples for android.widget Toast show

Introduction

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

Prototype

public void show() 

Source Link

Document

Show the view for the specified duration.

Usage

From source file:Main.java

public static void showCenterShortToast(String text, Context ctx) {

    int duration = Toast.LENGTH_SHORT;

    Toast toast = Toast.makeText(ctx, text, duration);

    toast.setGravity(Gravity.CENTER, 0, 0);

    toast.show();

}

From source file:Main.java

public static void showToast(Context context, String msg) {
    Toast toast = Toast.makeText(context, msg, Toast.LENGTH_SHORT);
    toast.setGravity(Gravity.CENTER, 0, 0);
    toast.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 source file:Main.java

public static void showToast_Short(Context context, String text) {
    Toast toast = Toast.makeText(context, text, Toast.LENGTH_SHORT);
    toast.setGravity(Gravity.CENTER, 0, 0);
    toast.show();
}

From source file:Main.java

public static boolean showErrorToastCenter(Context context, String msg) {
    Toast toast = Toast.makeText(context, msg, Toast.LENGTH_SHORT);
    toast.setGravity(Gravity.CENTER, 0, 0);
    toast.show();
    return false;
}

From source file:Main.java

public static void infoAlert(Activity activity, String msg) {
    Toast toast = Toast.makeText(activity, msg, Toast.LENGTH_SHORT);
    toast.setGravity(Gravity.CENTER, 0, 0);
    toast.show();
}

From source file:Main.java

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

From source file:Main.java

public static void showToast(Context ctx, int id) {

    Context context = ctx;// w  ww  .jav  a  2 s  .co m
    int duration = Toast.LENGTH_SHORT;
    Toast toast = Toast.makeText(context, context.getResources().getString(id), duration);
    toast.show();
}

From source file:Main.java

public static void showToast(Context ctx, String message) {
    Toast tost = Toast.makeText(ctx, message, Toast.LENGTH_SHORT);
    tost.setGravity(Gravity.CENTER, 0, 0);
    tost.show();
}

From source file:Main.java

public static void showToast(Context context, String string) {
    Toast toast = Toast.makeText(context, string, Toast.LENGTH_SHORT);
    toast.setGravity(Gravity.CENTER, 0, 0);
    toast.show();
}