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

/**
 * Shows a long toast/*ww w .  j av a2s  .c om*/
 *
 * @param context: The current context
 * @param msg: The toast's message
 */
public static void showLongToast(Context context, CharSequence msg) {
    Toast.makeText(context, msg, Toast.LENGTH_LONG).show();
}

From source file:Main.java

public static void showLong(Context context, String msg) {
    if (context != null && !TextUtils.isEmpty(msg)) {
        Toast.makeText(context.getApplicationContext(), msg, Toast.LENGTH_LONG).show();
    }//from  w  w w  .  j ava  2s. com
}

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

public static void makeToast(Context context, String s, int length) {

    Toast.makeText(context, s, length).show();
}

From source file:Main.java

public static void showShort(Context context, String msg) {
    if (context != null && !TextUtils.isEmpty(msg)) {
        Toast.makeText(context.getApplicationContext(), msg, Toast.LENGTH_SHORT).show();
    }/*  w  ww .  ja v a  2 s .  co m*/
}

From source file:Main.java

/**
 * Shows a short toast//from  www.j a v  a2  s  . c om
 *
 * @param context: The current context
 * @param msg: The toast's message
 */
public static void showShortToast(Context context, CharSequence msg) {
    Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
}

From source file:Main.java

public static void showToast(String message, Context context) {
    CharSequence text = message;/*from   ww w. ja va  2 s  . c  om*/
    int duration = Toast.LENGTH_SHORT;
    Toast toast = Toast.makeText(context, text, duration);
    toast.show();
}

From source file:Main.java

public static void toastShow(Context paramContext, String paramString) {
    Toast.makeText(paramContext, paramString, 0).show();
}

From source file:Main.java

private static void show(Context context, String message, int duration) {
    Toast.makeText(context, message, duration).show();
}