Android Utililty Methods Toast Create

List of utility methods to do Toast Create

Description

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

Method

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
Toast.makeText(context, text, Toast.LENGTH_SHORT).show();
voidtoast(Context c, String msg)
toast
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);
toast.show();
voidshowMessage(final Activity context, final String message)
show Message
context.runOnUiThread(new Runnable() {
    @Override
    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),
        Toast.LENGTH_LONG).show();
voidshowElapsed(long start, long end, Context ctx)
show Elapsed
Log.i("ElapsedTimeUtil",
        "Request took " + getElapsedSeconds(start, end)
                + " seconds to execute");