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 showToast(Context paramContext, String paramString) {
    Toast.makeText(paramContext, paramString, 0).show();
}

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

/**
 * Toast//from ww w  .j a v  a 2s. co m
 * @param context
 * @param msg
 */
public static void showToast(Context context, String msg) {
    if (!TextUtils.isEmpty(msg)) {
        Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
    }
}

From source file:Main.java

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

From source file:Main.java

public static void toastOnUI(final Activity activity, final String toastText, final int duration) {
    activity.runOnUiThread(new Runnable() {

        @Override/*from   w  w w  .j a  v a  2  s.c  o m*/
        public void run() {
            Toast.makeText(activity, toastText, duration).show();
        }
    });
}

From source file:Main.java

public static void showToast(Context context, CharSequence text, int time) {
    if (toast == null) {
        toast = Toast.makeText(context, text, time);
    } else {//from  w  w w  .j  a v  a  2  s .c om
        toast.setText(text);
        toast.setDuration(time);
    }
    toast.show();
}

From source file:Main.java

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

From source file:Main.java

public static void showToastMessage(Context context, int resId, int time) {
    Toast.makeText(context, resId, time).show();
}

From source file:Main.java

/**
 * Show toast.//from   ww w  .j  a  va  2 s. c o m
 *
 * @param context the context
 * @param text the text
 * @param duration the duration
 */
public static void showToast(Context context, CharSequence text, int duration) {
    Toast.makeText(context, text, duration).show();
}