在内部存储器中创建文件夹以保存文件并在以后检索它们

Reh*_*ham 5 memory directory android internal

我想在我的应用程序的内存中创建一个文件夹来存储音频文件,然后检查是否存在进行某些操作.如何制作这个folde,在哪个路径,以及如何再次检索这些文件?

iSu*_*Sun 12

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

要从内部删除文件:

if (new File("path/to/file").delete()) {
  // Deleted
} else {
  // Not deleted
}
Run Code Online (Sandbox Code Playgroud)