Last active
November 24, 2016 09:55
-
-
Save Antarix/3878682 to your computer and use it in GitHub Desktop.
Create Directories on Android SdCard. Simply pass the url as a parameter e.g "/myfolder/newFolder"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void createDirectories(String url) { | |
Log.d("DIRECTORY CHECK", "Checking directory " + url + " exist or not"); | |
File SDCardRoot = new File(Environment.getExternalStorageDirectory() | |
.toString() + url); | |
if (!SDCardRoot.exists()) { | |
Log.d("DIRECTORY CHECK", | |
"Directory doesnt exist creating directory " | |
+ Environment.getExternalStorageDirectory() | |
.toString()); | |
boolean outcome = SDCardRoot.mkdirs(); | |
Log.d("DIRECTORY CHECK", | |
"outcome for " + SDCardRoot.getAbsolutePath() + " " | |
+ outcome); | |
} | |
Log.d("DIRECTORY CHECK", "Directory created successfully!"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment