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, int info) {
    Toast.makeText(context, info, Toast.LENGTH_LONG).show();
}

From source file:Main.java

/**
 * Zeigt Standard Toast./*from   ww  w.  j a v  a2s . c  o  m*/
 * @param _Activity
 * @param _message Darzustellende Nachricht
 */
public static void showToast(Activity _Activity, String _message) {
    Toast.makeText(_Activity, _message, Toast.LENGTH_SHORT).show();
}

From source file:Main.java

public static void showToast(Context context, String text) {
    if (toast == null) {
        toast = Toast.makeText(context, text, Toast.LENGTH_SHORT);
    } else {/*ww  w . j a  v  a2 s  .  co m*/
        toast.setText(text);
    }
    toast.show();
}

From source file:Main.java

public static Toast showLong(Context context, CharSequence message) {
    if (null == toast) {
        toast = Toast.makeText(context, message, Toast.LENGTH_LONG);
        // toast.setGravity(Gravity.CENTER, 0, 0);
    } else {/*w w  w.  j a  v  a2 s.c om*/
        toast.setText(message);
    }
    toast.show();
    return toast;
}

From source file:Main.java

public static void showToast(Context mContext, String msg) {
    if (mToast == null) {
        mToast = Toast.makeText(mContext, "", Toast.LENGTH_SHORT);
    }/*w  ww.  j a va2s  . co  m*/
    mToast.setText(msg);
    mToast.show();
}

From source file:Main.java

public static void showToast(Context context, String message) {
    if (toast == null) {
        toast = Toast.makeText(context, message, Toast.LENGTH_SHORT);
    } else {//from www.  j  a v a 2 s  .  com
        toast.setText(message);
    }
    toast.show();
}

From source file:Main.java

public static void showMessage(Context context, String msg) {
    if (context == null || TextUtils.isEmpty(msg)) {
        return;//from   w  w  w  .  jav  a  2 s.c om
    }
    Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
}

From source file:Main.java

public static Toast showShort(Context context, CharSequence message) {
    if (null == toast) {
        toast = Toast.makeText(context, message, Toast.LENGTH_SHORT);
        // toast.setGravity(Gravity.CENTER, 0, 0);
    } else {//w  ww  .j ava2 s.  com
        toast.setText(message);
    }
    toast.show();
    return toast;
}

From source file:Main.java

public static void showToast(Context context, String text, int duration) {
    if (toast != null) {
        toast.cancel();/*from   w  w w  .  j  a v a2s. c om*/
    }
    toast = Toast.makeText(context, text, duration);
    toast.show();
}

From source file:Main.java

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