I’m in the process of making an Android application that creates a new file when a button is pressed. I’m using the following code:
File file = new File(Environment.getExternalStorageDirectory()
+File.separator
+"myDirectory" //folder name
+File.separator
+"myFile.png"); //file name
file.mkdirs();
However, myFile.png is actually being displayed as a directory and not a .png file.
Because of
file.mkdirs();mkdirs() – is used for making directory by filename given file object’s parameter, If you want to make a file make IO operation for writing in a file,In your case: to make a directory,
This make a myDirectory folder in external storage.