Skip to content

Commit

Permalink
Use ContextCompat.getExternalFilesDirs()
Browse files Browse the repository at this point in the history
  • Loading branch information
di72nn committed Dec 1, 2016
1 parent e4990cd commit 4915c1c
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package fr.gaulupeau.apps.Poche.network;

import android.support.v4.content.ContextCompat;
import android.util.Log;

import java.io.File;
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 4915c1c

Please sign in to comment.