Example usage for android.widget Toast LENGTH_SHORT

List of usage examples for android.widget Toast LENGTH_SHORT

Introduction

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

Prototype

int LENGTH_SHORT

To view the source code for android.widget Toast LENGTH_SHORT.

Click Source Link

Document

Show the view or text notification for a short period of time.

Usage

From source file:Main.java

public static void showWrongAPIVersion(Context context) {
    Toast.makeText(context, "Not avaible on this API", Toast.LENGTH_SHORT).show();
}

From source file:Main.java

public static void checkNullStateByBoolean(Context context, boolean empty, String message) {
    if (empty) {/*from w w  w .  j ava  2 s .  c  o  m*/
        Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
        throw new IllegalStateException(message);
    }
}

From source file:Main.java

public static void showToast(Context context, String message) {
    Toast toast = Toast.makeText(context, message, Toast.LENGTH_SHORT);
    toast.setGravity(Gravity.CENTER, 0, 0);
    toast.show();/*from w ww  . j  a  v  a2 s .c om*/
}

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();/*w  w w  . j av a2 s . c  om*/
}

From source file:Main.java

public static void showToast(Context context, String message) {
    if (message != null && context != null) {
        Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
    }/* w  ww .ja  va2s .  c  o  m*/
}

From source file:Main.java

public final static void showToastMessage(Context context, String message) {
    Toast toast = Toast.makeText(context, message, Toast.LENGTH_SHORT);
    toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
    toast.show();/*www  .  j a  va 2s .  c o m*/
}

From source file:Main.java

public static void showToastOnMainThread(Context context, String msg) {
    Looper.prepare();
    Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
    Looper.loop();
}

From source file:Main.java

public static void showToast(String msg, Context context) {
    toast.cancel();
    toast = Toast.makeText(context, msg, Toast.LENGTH_SHORT);
    toast.show();
}

From source file:Main.java

/**
 * show Toast/* w  ww .  ja  v  a2 s  .  c om*/
 * @param context
 * @param id
 */
public static void toast(Context context, int id) {
    Toast.makeText(context, id, Toast.LENGTH_SHORT).show();
}

From source file:Main.java

public static void DisplayToast(Context context, String text) {
    Toast toast;/*  w  w  w .  ja va  2s .  co  m*/
    toast = Toast.makeText(context, text, Toast.LENGTH_SHORT);
    toast.setGravity(Gravity.CENTER, 0, 0);
    toast.show();
}