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 httpSendSuccessReturn3(Context context, String messageForUser) {
    if (null != messageForUser) {
        Toast.makeText(context, messageForUser, Toast.LENGTH_SHORT).show();
    }//from   w ww  . j a  v  a2 s . c o m
}

From source file:Main.java

public static void displayToast(String message, Context context) {

    int duration = Toast.LENGTH_SHORT;
    Toast toast = Toast.makeText(context, message, duration);
    toast.show();//from w w  w.j a  va2  s .c o  m

}

From source file:Main.java

public static void DisplayToast(Context context, String text) {
    Toast toast;/*from  www. ja  v a 2s.  c  om*/
    toast = Toast.makeText(context, text, Toast.LENGTH_SHORT);
    toast.setGravity(Gravity.CENTER, 0, 0);
    toast.show();
}

From source file:Main.java

public static void showToastOnMainThread(Context context, String msg) {
    Looper.prepare();
    Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
    Looper.loop();
}

From source file:Main.java

public static void showToast(String msg, Context context) {
    toast.cancel();
    toast = Toast.makeText(context, msg, Toast.LENGTH_SHORT);
    toast.show();
}

From source file:Main.java

public static void toast(Context context, final String message, final int length) {
    Toast.makeText(context, message, length).show();
}

From source file:Main.java

/**
 * show Toast//from ww w.  ja v  a  2s.  c  o m
 * @param context
 * @param id
 */
public static void toast(Context context, int id) {
    Toast.makeText(context, id, Toast.LENGTH_SHORT).show();
}

From source file:Main.java

public static void showLongMessage(Context mContext, CharSequence text) {
    if (text != null && text.length() > 0) {
        Toast.makeText(mContext, text, Toast.LENGTH_LONG).show();
    }/* w  ww .  j  ava2s .  co  m*/
}

From source file:Main.java

public static void printError(Activity ctx, String message) {

    if (ctx != null && message != null) {
        Toast toast = Toast.makeText(ctx, message, Toast.LENGTH_LONG);
        toast.show();/*from  w  ww  . j  a va 2s. c o  m*/
    }

}

From source file:Main.java

public static void showShortMessage(Context mContext, CharSequence text) {
    if (text != null && text.length() > 0) {
        Toast.makeText(mContext, text, Toast.LENGTH_SHORT).show();
    }//from  w ww.  ja v  a  2s  .  com
}