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 showToastUseStringFile(Context theContext, int theStringValue) {
    Toast toast = Toast.makeText(theContext, theStringValue, Toast.LENGTH_SHORT);
    toast.show();//from w w w .  j  a v  a2s. co  m
}

From source file:Main.java

public static void showToast(Context context, String msg) {
    Toast toast = Toast.makeText(context, msg, Toast.LENGTH_SHORT);
    toast.setGravity(Gravity.CENTER, 0, 0);
    toast.show();/*from   w w  w.java 2  s  .com*/
}

From source file:Main.java

public static void infoAlert(Activity activity, String msg) {
    Toast toast = Toast.makeText(activity, msg, Toast.LENGTH_SHORT);
    toast.setGravity(Gravity.CENTER, 0, 0);
    toast.show();//from  w  w  w  . j a  v  a 2 s  . c  om
}

From source file:Main.java

public static void showToastShort(String message) {
    Toast toast = Toast.makeText(context, message, Toast.LENGTH_SHORT);
    toast.show();
}

From source file:Main.java

public static void ShowToast(Context context, String message) {
    Toast msg = Toast.makeText(context, message, Toast.LENGTH_SHORT);
    msg.setGravity(Gravity.CENTER, msg.getXOffset() / 2, msg.getYOffset() / 2);
    msg.show();//  ww w  . j a  v  a 2 s .  c  o  m
}

From source file:Main.java

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

From source file:Main.java

public static void showToast(Context context, String text) {
    if (null != text && !text.isEmpty())
        Toast.makeText(context, text, Toast.LENGTH_SHORT).show();
}

From source file:Main.java

public static void showToast(Context ctx, String message) {
    Toast tost = Toast.makeText(ctx, message, Toast.LENGTH_SHORT);
    tost.setGravity(Gravity.CENTER, 0, 0);
    tost.show();/*  w  ww . ja v  a 2s . com*/
}

From source file:Main.java

public static void showToast(Activity activity, String message) {
    if (message != null) {
        Toast.makeText(activity, message, Toast.LENGTH_SHORT).show();
    }//  ww w  .  j a v a 2s . c om
}

From source file:Main.java

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