If a folder (directory) is not existed, create it – Android Java Snippet

With this snippet, we are able to check if a folder existed in device’s storage or not. If not, then we create it.

Here is the snippet:

File directory = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/afolder");
if (! directory.exists()){
	directory.mkdir();
}

 

loading...

Leave a Reply

Your email address will not be published. Required fields are marked *