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(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();/*  w  w w . ja v a2 s . co  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 showMiddleToast(Context cxt, String msg) {
    Toast toast = Toast.makeText(cxt, msg, Toast.LENGTH_SHORT);
    toast.setGravity(Gravity.CENTER, 0, 0);
    toast.show();//w  ww  .j av a 2s .c o m
}

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 ww  .  ja va  2s. c o  m*/
}

From source file:Main.java

public static void showToast(Activity activity, String message) {
    if (message != null) {
        Toast.makeText(activity, message, Toast.LENGTH_SHORT).show();
    }/*  www. j av  a 2 s .c  o m*/
}

From source file:Main.java

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

From source file:Main.java

public static void showToast(Context context, int rID, int durationType) {
    if (rID > 0) {
        Toast.makeText(context, rID, durationType).show();
    }/* w  w  w  .  j  a  v a  2 s  .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();/*  w w w.  j a  v a 2  s.c  o m*/
}

From source file:Main.java

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

From source file:Main.java

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