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 showToast(String text, Context context) {
    Toast.makeText(context, text, Toast.LENGTH_SHORT).show();
}

From source file:Main.java

public static void showToastShort(Context context, String text) {
    Toast.makeText(context, text, Toast.LENGTH_SHORT).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();
    }/* ww  w.java  2s.  c om*/
}

From source file:Main.java

public static void showToastNotification(final String msg, final Activity activity) {
    if (activity == null)
        return;/* w w  w .  ja  va 2s.  c o m*/

    activity.runOnUiThread(new Runnable() {
        public void run() {
            Toast.makeText(activity, msg, Toast.LENGTH_SHORT).show();
        }
    });

}

From source file:Main.java

public static void ShowToast(Activity activity, String str, boolean isLong) {
    if (isLong) {
        Toast.makeText(activity, str, Toast.LENGTH_LONG).show();
    } else {/*from  w w w . j  a v  a 2  s  .  c  o  m*/
        Toast.makeText(activity, str, Toast.LENGTH_SHORT).show();
    }
}

From source file:Main.java

/**
 * Show toast.//from   w  ww .  j  a  va 2  s .  co  m
 * 
 * @param appContext
 *            the app context
 * @param message
 *            the message
 */
public static void showToast(Context appContext, String message) {

    Toast.makeText(appContext, message, Toast.LENGTH_SHORT).show();
}

From source file:Main.java

/**
 * Short toast message//from  w  ww.jav a2  s  .c  om
 *
 * @param c Application Context
 * @param msg Message to send
 */
public static void msgShort(final Context c, final String msg) {
    if (c != null && msg != null) {
        Toast.makeText(c, msg.trim(), Toast.LENGTH_SHORT).show();
    }
}

From source file:Main.java

public static void showToast(Context context, int resId) {

    Toast.makeText(context, resId, Toast.LENGTH_SHORT).show();
}

From source file:Main.java

/**
 * shows a toast//ww  w.  j a va2s  .  c  o m
 *
 * @param context context of calling activity
 * @param text    text to be displayed
 */
public static void showToast(Context context, String text) {
    Toast.makeText(context, text, Toast.LENGTH_SHORT).show();
}

From source file:Main.java

public static void showToast(Context mContext, String text) {
    if (toast == null) {
        toast = Toast.makeText(mContext, text, Toast.LENGTH_SHORT);
    } else {//from  w  ww.jav  a 2  s .c  o  m
        toast.setText(text);
    }

    handler.post(new Runnable() {

        @Override
        public void run() {
            toast.show();
        }
    });
}