diff options
author | Scott Jackson <daneren2005@gmail.com> | 2014-12-01 22:06:55 -0800 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2014-12-01 22:06:55 -0800 |
commit | 3f28cdaaa53cfcd592409f869f2e051704f90e06 (patch) | |
tree | 7f2e6db33f6d7f9919a9b5e04dc27c3127697e5e /src/github/daneren2005 | |
parent | 0ef10171df111bfa8510e569f4bc939e64beb842 (diff) | |
download | dsub-3f28cdaaa53cfcd592409f869f2e051704f90e06.tar.gz dsub-3f28cdaaa53cfcd592409f869f2e051704f90e06.tar.bz2 dsub-3f28cdaaa53cfcd592409f869f2e051704f90e06.zip |
Use the new media dir API on 5.0+
Diffstat (limited to 'src/github/daneren2005')
-rw-r--r-- | src/github/daneren2005/dsub/util/FileUtil.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/github/daneren2005/dsub/util/FileUtil.java b/src/github/daneren2005/dsub/util/FileUtil.java index 7afeec93..ac2c080b 100644 --- a/src/github/daneren2005/dsub/util/FileUtil.java +++ b/src/github/daneren2005/dsub/util/FileUtil.java @@ -403,7 +403,13 @@ public class FileUtil { public static File getDefaultMusicDirectory(Context context) { if(DEFAULT_MUSIC_DIR == null) { - File[] dirs = ContextCompat.getExternalFilesDirs(context, null); + File[] dirs; + if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + dirs = context.getExternalMediaDirs(); + } else { + dirs = ContextCompat.getExternalFilesDirs(context, null); + } + for(int i = dirs.length - 1; i >= 0; i--) { DEFAULT_MUSIC_DIR = new File(dirs[i], "music"); if(dirs[i] != null) { |