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();
}