I am currently building a file management app that allows the user to browse the file system of their device. The user starts off in the root directory / of the
/
path.mkdir() fails also when the directory already exists. You can add a check first:
path.mkdir()
if (!path.exists()) { boolean success = path.mkdir(); Log.d(TAG, path.getAbsolutePath() + FOLDER_CREATION_SUCCESS + success); path.delete(); } else { Log.d(TAG, path.getAbsolutePath() + "already exists"); }