1

I tried this link:

How to create text file and insert data to that file on Android

But, it says "No such file or directory". Can anybody help me please? Thanks in advance!

Pakz
  • 123
  • 2
  • 15

1 Answers1

0

---- Updated answer----

I think you can't create a directory inside the internal storage of the device. Except you've a root access for the app. You can only create the directory inside your app private folder within the following path String path = getFilesDir().

you can use like this below -

File mydir = context.getDir("mydirectory", Context.MODE_PRIVATE); //Creating an internal dir;
File fileWithinMyDir = new File(mydir, "myAwesomeFile"); //Getting a file within the dir.
FileOutputStream out = new FileOutputStream(fileWithinMyDir); //Use the stream as usual to write into the file.

getDir(StringName, int mode) method to create or access directories in internal storage.

/storage/emulated/0/Notes/ will always return No such file or directory except device is rooted and dir.mkDirs() will always return false for this path.

Hope this will help you.

Dipankar Baghel
  • 1,932
  • 2
  • 12
  • 24