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 message) {
    if (toast == null) {
        toast = Toast.makeText(context, message, Toast.LENGTH_SHORT);
    } else {/*from   www  . j  a v  a2  s. c om*/
        toast.setText(message);
    }
    toast.show();
}

From source file:Main.java

/**
 * Zeigt Standard Toast.// w ww .ja  v a2s .  co m
 * @param _Activity
 * @param _message Darzustellende Nachricht
 */
public static void showToast(Activity _Activity, String _message) {
    Toast.makeText(_Activity, _message, Toast.LENGTH_SHORT).show();
}

From source file:Main.java

public static void showToast(Context context, int msg) {
    Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
}

From source file:Main.java

public static Toast showShort(Context context, CharSequence message) {
    if (null == toast) {
        toast = Toast.makeText(context, message, Toast.LENGTH_SHORT);
        // toast.setGravity(Gravity.CENTER, 0, 0);
    } else {//from ww w .j  ava2  s  .  c om
        toast.setText(message);
    }
    toast.show();
    return toast;
}

From source file:Main.java

public static void alertMsg(Context context, int msg) {
    Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
}

From source file:Main.java

public static void makeToast(Context context, String text) {
    if (toast == null) {
        toast = Toast.makeText(context, text, Toast.LENGTH_SHORT);
    } else {/* www  . j ava 2  s  . c o  m*/
        toast.setText(text);
    }
    toast.show();
}

From source file:Main.java

public static void ToastMessage(Context cont, int msg) {
    Toast.makeText(cont, msg, Toast.LENGTH_SHORT).show();
}

From source file:Main.java

public static boolean isValidPost(String post, Context thisActivtiy) {
    //If no words typed
    if (post.equals("")) {
        Toast.makeText(thisActivtiy, "Please enter in a post.", Toast.LENGTH_SHORT).show();
        return false;
    }//from  w  w w .  j av a 2  s .  co  m
    //The info is not of the right format
    else if (false) {
        Toast.makeText(thisActivtiy, ".", Toast.LENGTH_SHORT).show();
        return false;
    }
    //Filter it and it is bad!
    else if (false) {
        Toast.makeText(thisActivtiy, ".", Toast.LENGTH_SHORT).show();
        return false;
    }
    //Everything is good and the info can be used to create a new account
    else
        return true;
}

From source file:Main.java

public static void showSingleToast(Context context, String text) {
    if (sToast == null) {
        sToast = Toast.makeText(context, text, Toast.LENGTH_SHORT);
    }//from www .j a v  a  2 s .c o m
    sToast.setText(text);
    sToast.show();
}

From source file:Main.java

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