Android Utililty Methods Toast Create

List of utility methods to do Toast Create


The list of methods to do Toast Create are organized into topic(s).


voidshowToask(Context context, String tip)
show Toask
Toast.makeText(context, tip, Toast.LENGTH_SHORT).show();
voidshowToast(Context context, String msg)
show Toast
Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
voidtoast(Context context, String text)
Toast.makeText(context, text, Toast.LENGTH_SHORT).show();
voidtoast(Context c, String msg)
Toast.makeText(c, msg, Toast.LENGTH_SHORT).show();
voidshowToastShort(Activity ctx, String text)
show Toast Short
Toast.makeText(ctx, text, Toast.LENGTH_SHORT).show();
voidshowToastLong(Activity ctx, String text)
show Toast Long
Toast.makeText(ctx, text, Toast.LENGTH_LONG).show();
voidshowMessage(Context ctx, String msg)
show Message
Toast toast = Toast.makeText(ctx, msg, Toast.LENGTH_SHORT);
toast.setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL, 0, 580);;
voidshowMessage(final Activity context, final String message)
show Message
context.runOnUiThread(new Runnable() {
    public void run() {
        Toast.makeText(context, message, Toast.LENGTH_LONG).show();
voidshowFailure(Activity activity, int id)
show Failure
Toast.makeText(activity, activity.getResources().getString(id),
voidshowElapsed(long start, long end, Context ctx)
show Elapsed
        "Request took " + getElapsedSeconds(start, end)
                + " seconds to execute");