code: public static void sendToast(@NonNull Context context, String toast, @IntRange(from = 0, to = 1) int toastLength) {
          try {
              Toast.makeText(context, toast, toastLength).show();
          } catch (RuntimeException e) {
              ACRA.log.w(LOG_TAG, "Could not send crash Toast", e);
          }
      }
docs: Sends a Toast and ensures that any Exception thrown during sending is handled.
  
  @param context     Application context.
  @param toast       toast message.
  @param toastLength Length of the Toast.