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

From source file:Main.java

public static void showToast(String msg) {
    if (context_ != null) {
        Toast.makeText(context_, msg, Toast.LENGTH_SHORT).show();
    }
}

From source file:Main.java

public static void showToast(Context context, String text, int longint) {
    // TODO Auto-generated method stub
    Toast.makeText(context, text, longint).show();
}

From source file:Main.java

public static boolean showErrorToastCenter(Context context, String msg) {
    Toast toast = Toast.makeText(context, msg, Toast.LENGTH_SHORT);
    toast.setGravity(Gravity.CENTER, 0, 0);
    toast.show();//  w  w  w.  ja v a2s .  c  o  m
    return false;
}

From source file:Main.java

public static void showToastLong(Context context, String message) {
    if (message != null && context != null) {
        Toast.makeText(context, message, Toast.LENGTH_LONG).show();
    }//from  w w w  .j  ava 2s  . c o  m
}

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();
    }// www .  j ava2s  .c  om
}

From source file:Main.java

/**
 *
 * @param context/*w  w  w . j av  a  2 s  .c o  m*/
 * @param msg
 */
public static void Toast(Context context, String msg) {
    Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
}

From source file:Main.java

public static void showToast(Context context, String text, int duration) {
    Toast toast = Toast.makeText(context, text, duration);
    toast.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL, 0, 0);
    toast.show();//from   w w  w .  j a  v  a2s. c  om
}

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();//from  ww  w  . j a  v a 2  s. com
}

From source file:Main.java

/**
 * Show a toast message./*  ww w  . j av a 2s. c o m*/
 */
private static void showToast(Context context, String message, int length) {
    Toast.makeText(context, message, length).show();
}