diff --git a/app/src/main/java/rs/chir/invtracker/client/ItemDetailFragment.java b/app/src/main/java/rs/chir/invtracker/client/ItemDetailFragment.java index 0c69f55..9162402 100644 --- a/app/src/main/java/rs/chir/invtracker/client/ItemDetailFragment.java +++ b/app/src/main/java/rs/chir/invtracker/client/ItemDetailFragment.java @@ -151,7 +151,7 @@ public class ItemDetailFragment extends FragmentBase var fileName = image.getPath().substring(image.getPath().lastIndexOf('/')); var path = this.requireActivity().getCacheDir().getAbsolutePath(); new File(path, "images").mkdirs(); - path += new File(new File(path, "images"), fileName); + path += "/images/" + fileName; // TODO: check if there is a better buffer size to use // ideally I would use {@link java.nio.file.Files#copy(InputStream, Path, CopyOption...)} but it is not available on API level 21 @@ -177,7 +177,8 @@ public class ItemDetailFragment extends FragmentBase private Optional getImageIfPresent(@NonNull URI uri) { var fileName = uri.getPath().substring(uri.getPath().lastIndexOf('/')); var path = this.requireActivity().getCacheDir().getAbsolutePath(); - var file = new File(new File(path, "images"), fileName); + path += "/images/" + fileName; + var file = new File(path); // Check if the image is present in the cache if (file.exists()) { try {