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 showToast(String message, Context context) {
    Toast toast = Toast.makeText(context, message, Toast.LENGTH_SHORT);
    toast.setGravity(Gravity.CENTER, 0, 0);
    toast.show();
}

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

public static void showToast(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

/**
 * Shows a short toast display//from   w  ww  .j ava 2  s  .  co  m
 * 
 * @param ctx application context
 * @param message message to display
 */
public static void showToast(Context ctx, String message) {
    Toast toast = Toast.makeText(ctx, message, Toast.LENGTH_SHORT);
    toast.setGravity(Gravity.CENTER, 0, 0);
    toast.show();

}

From source file:Main.java

/**
 * Zeigt Positionierten Toast./*from   w  w w .j a v  a  2  s  .  c  o m*/
 * @param _Activity
 * @param _message  Darzustellende Nachricht
 * @param _Gravity  Position des Toasts
 */
public static void showPositionedToast(Activity _Activity, String _message, int _Gravity) {
    Toast toast = Toast.makeText(_Activity, _message, Toast.LENGTH_SHORT);
    toast.setGravity(_Gravity, 0, 120);
    toast.show();
}

From source file:Main.java

public static void showToast(final Activity activity, final String msg) {
    Log.i(TAG, "Show Toast: " + msg);

    if (activity == null) {
        return;//from   w w  w  . jav  a2s.c o m
    }
    activity.runOnUiThread(new Runnable() {
        @Override
        public void run() {
            try {
                Toast toast = Toast.makeText(activity, msg, Toast.LENGTH_LONG);
                toast.show();
            } catch (Throwable e) {
                Log.e(TAG, "error: " + e, e);
            }
        }
    });
}

From source file:Main.java

public static void toast(Context mcontext, String toastStr, int i) {
    Toast toast = Toast.makeText(mcontext, toastStr, Toast.LENGTH_SHORT);
    toast.setGravity(i, 0, 0);//Gravity.CENTER
    toast.show();
}

From source file:Main.java

public static void ShowToastMessage(Context mContext, String xMessage) {
    Toast mToast = Toast.makeText(mContext, xMessage, Toast.LENGTH_SHORT);
    mToast.setGravity(Gravity.CENTER, 0, 0);
    mToast.show();
}

From source file:Main.java

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