diff --git a/app/src/main/java/fr/gaulupeau/apps/Poche/network/ImageCacheUtils.java b/app/src/main/java/fr/gaulupeau/apps/Poche/network/ImageCacheUtils.java index 201e68e9b..c95b260e3 100644 --- a/app/src/main/java/fr/gaulupeau/apps/Poche/network/ImageCacheUtils.java +++ b/app/src/main/java/fr/gaulupeau/apps/Poche/network/ImageCacheUtils.java @@ -1,5 +1,6 @@ package fr.gaulupeau.apps.Poche.network; +import android.support.v4.content.ContextCompat; import android.util.Log; import java.io.File; @@ -158,12 +159,7 @@ public static void downloadImageToCache(String imageURL, String destination, Lon public static String getExternalStoragePath() { if (externalStoragePath == null) { String returnPath = null; - File[] extStorage; - if(android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) { - extStorage = App.getInstance().getExternalFilesDirs(null); - } else { - extStorage = new File[] {App.getInstance().getExternalFilesDir(null)}; - } + File[] extStorage = ContextCompat.getExternalFilesDirs(App.getInstance(), null); if (extStorage == null) { Log.w(TAG, "onCreate: getExternalFilesDirs() returned null or is not readable"); } else {