@Nullable
    public static Bitmap readImageFromStream(@NonNull final Supplier<InputStream> streamSupplier, @Nullable final BitmapFactory.Options bfOptions, @Nullable final Object logId) {
        Bitmap image = null;
        //try reading as normal bitmap first
        try (InputStream is = streamSupplier.get()) {
            if (is == null) {
                Log.w("Can't open '" + logId + "' for image reading, maybe is doesn't exist?");
                return null;
            }
            image = BitmapFactory.decodeStream(is, null, bfOptions);
        } catch (Exception ex) {
            Log.w("Error processing '" + logId + "'", ex);
        }

        if (image == null) {
            //try to read as SVG
            try (InputStream is = streamSupplier.get()) {
                if (is == null) {
                    Log.w("Can't open '" + logId + "' for image reading, maybe is doesn't exist?");
                    return null;
                }
                image = ImageUtils.readSVGImageFromStream(is, logId);
            } catch (Exception ex) {
                Log.w("Error processing '" + logId + "'", ex);
            }
        }
        return image;
    }
tries to read an image from a stream supplier. Returns null if this fails. Supports normal Android bitmaps and SVG.
main/src/main/java/cgeo/geocaching/utils/ImageUtils.java