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

From source file:Main.java

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

From source file:Main.java

public static void toast(Context context, String msg) {
    if (context != null || msg != null) {
        Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
    }//w ww . j a  va  2s  . c  om
}

From source file:Main.java

public static void showMessage(Context context, String msg) {
    Toast toast = Toast.makeText(context.getApplicationContext(), msg, Toast.LENGTH_LONG);
    toast.setGravity(Gravity.CENTER, 0, 0);
    toast.show();//from  ww w. jav  a 2s . c  om
}

From source file:Main.java

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

From source file:Main.java

public static void showMessage(Context context, int messageID) {
    if (context != null) {
        Toast.makeText(context, messageID, Toast.LENGTH_LONG).show();
    }/*  w ww . j  av  a2  s . c om*/
}

From source file:Main.java

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

From source file:Main.java

public static void showToast(Context context, String msg) {

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

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 toast(String message, Context context) {
    Toast msg = Toast.makeText(context, message, Toast.LENGTH_LONG);
    msg.setGravity(Gravity.CENTER, msg.getXOffset() / 2, msg.getYOffset() / 2);
    msg.show();//from ww  w .  ja  v  a 2s  .  c  o  m
}