Example usage for android.widget Toast LENGTH_SHORT

List of usage examples for android.widget Toast LENGTH_SHORT

Introduction

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

Prototype

int LENGTH_SHORT

To view the source code for android.widget Toast LENGTH_SHORT.

Click Source Link

Document

Show the view or text notification for a short period of time.

Usage

From source file:Main.java

public static void showToast(Context context, String string) {
    Toast toast = Toast.makeText(context, string, Toast.LENGTH_SHORT);
    toast.setGravity(Gravity.CENTER, 0, 0);
    toast.show();//from w  w  w.j ava2 s .c om
}

From source file:Main.java

public static void toastMessage(Context context, String string) {
    // TODO Auto-generated method stub
    Toast.makeText(context, string, Toast.LENGTH_SHORT).show();
}

From source file:Main.java

public static void showToast(Context context, String text) {
    Toast toast = Toast.makeText(context, text, Toast.LENGTH_SHORT);
    toast.setGravity(Gravity.CENTER, 0, 0);
    toast.show();//  ww  w .ja  va 2 s.  c om
}

From source file:Main.java

public static void showToast(Context context, String message) {
    Toast toast = Toast.makeText(context, message, Toast.LENGTH_SHORT);
    toast.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL, 0, 0);
    toast.show();/*from   w w  w.j av  a 2  s . co m*/
}

From source file:Main.java

public static void showToast(Context ctx, String message) {
    Toast t = Toast.makeText(ctx, message, Toast.LENGTH_SHORT);
    t.show();
}

From source file:Main.java

public static void showToast(String message, Context context) {
    Toast toast = Toast.makeText(context, message, Toast.LENGTH_SHORT);
    toast.setGravity(Gravity.CENTER, 0, 0);
    toast.show();// w w w.j  ava  2  s.com
}

From source file:Main.java

public static void showShortToast(Context context, String message) {
    showToast(context, message, Toast.LENGTH_SHORT);
}

From source file:Main.java

public static void openToast(Context context, String str) {
    //Looper.prepare();
    Toast.makeText(context, str, Toast.LENGTH_SHORT).show();
    Looper.loop();/*from w w  w  .j  a v a2 s .c  om*/
}

From source file:Main.java

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

From source file:Main.java

public static void show(Context context, String text) {
    if (text == null) {
        text = "";
    }//w w w. j a  va2 s . c  om
    Toast.makeText(context, text, Toast.LENGTH_SHORT).show();
}