public static void initializeImageGallery(final ImageGalleryView imageGallery, final String geocode, final Collection<Image> images, final boolean showOwnCategory) {
        imageGallery.clear();
        imageGallery.setup(geocode);
        imageGallery.registerCallerActivity();
        if (geocode != null && showOwnCategory) {
            imageGallery.setEditableCategory(Image.ImageCategory.OWN.getI18n(), new ImageFolderCategoryHandler(geocode));
        }
        if (images != null) {
            //pre-create all contained categories to be in control of their sort order
            images.stream().map(img -> img.category)
                    .distinct().sorted().forEach(cat -> imageGallery.createCategory(
                            cat == Image.ImageCategory.UNCATEGORIZED ? null : cat.getI18n(), false));
            //add the images
            imageGallery.addImages(images);
        }
    }
gets or creates local file and shareable Uri for given image. Returns null if creation fails
main/src/main/java/cgeo/geocaching/utils/ImageUtils.java