Example usage for android.widget Toast show

List of usage examples for android.widget Toast show

Introduction

In this page you can find the example usage for android.widget Toast show.

Prototype

public void show() 

Source Link

Document

Show the view for the specified duration.

Usage

From source file:Main.java

/** Makes a long toast */
public static void longToast(String message, Context context) {
    CharSequence text = message;/*from w  w  w .  ja  v  a2 s  .com*/
    int duration = Toast.LENGTH_LONG;

    Toast toast = Toast.makeText(context, text, duration);
    toast.show();
}

From source file:Main.java

/** Makes a short toast */
public static void shortToast(String message, Context context) {
    CharSequence text = message;/* w ww.java2  s  .c  om*/
    int duration = Toast.LENGTH_SHORT;

    Toast toast = Toast.makeText(context, text, duration);
    toast.show();
}

From source file:Main.java

public static Toast showHint(Context context, String text) {
    Toast t = Toast.makeText(context, text, Toast.LENGTH_LONG);
    t.show();
    return t;//from   w  w  w  . j a  v  a 2s  .c om
}

From source file:Main.java

public static void showToastBottom(Context context, String s) {
    Toast toast = Toast.makeText(context, s, 0);
    toast.setGravity(81, 0, 80);/* w  ww.j a  va 2 s .  co m*/
    toast.show();
}

From source file:Main.java

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

From source file:Main.java

public static void showToast(CharSequence message, Context context) {
    int duration = Toast.LENGTH_SHORT;

    Toast toast = Toast.makeText(context.getApplicationContext(), message, duration);
    toast.show();
}

From source file:Main.java

/**
 * Display a short toast//w w  w .  j  a  v a 2s  .  co  m
 * @param context to use
 * @param id of the string resource
 */
public static void toast(Context context, int id) {
    Toast toast = Toast.makeText(context, context.getString(id), Toast.LENGTH_SHORT);
    toast.show();
}

From source file:Main.java

public static void showShortToast(final Context context, final int resId) {
    Toast toast = Toast.makeText(context, resId, Toast.LENGTH_SHORT);
    toast.show();
}

From source file:Main.java

public static void showToast(Context ctx, String message) {

    Context context = ctx;//from  w  w  w. j  a  v  a  2s .co m
    int duration = Toast.LENGTH_SHORT;
    Toast toast = Toast.makeText(context, message, duration);
    toast.show();
}

From source file:Main.java

public static void Toast(Context context, int resourceID) {
    Toast toast = Toast.makeText(context, resourceID, Toast.LENGTH_LONG);
    toast.show();
}