public static void showToast(@Nullable final Context context, final TextParam text, final boolean shortToast) {
        runOnUiThread(false, () -> {
            final Context toastContext = wrap(context == null || (context instanceof Activity && ((Activity) context).isFinishing()) ?
                    CgeoApplication.getInstance() : context);
            final int toastDuration = shortToast ? Toast.LENGTH_SHORT : Toast.LENGTH_LONG;
            final CharSequence toastText = text == null ? "---" : text.getText(toastContext);

            Log.iForce("[" + (context == null ? "APP" : context.getClass().getName()) + "].showToast(" + toastText + "){" + (shortToast ? "SHORT" : "LONG") + "}");
            try {
                final Toast toast = Toast.makeText(toastContext, toastText, toastDuration);
                if (Build.VERSION.SDK_INT < 30) {
                    toast.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM, 0, 100);
                }
                toast.show();
            } catch (RuntimeException re) {
                //this can happen e.g. in Unit tests when thread has no called Looper.prepare()
                Log.w("Could not show toast '" + toastText + "' to user", re);
            }
        });
    }
Shows a toast message to the user. This can be called from any thread.

@param context any context, usually an activity. If context is null, then the application context will be used.
@param text    the message
@param shortToast set to true if this should be a short toast
main/src/main/java/cgeo/geocaching/ui/ViewUtils.java