Creating folder in internal Memory to save files a

2019-01-14 09:45发布

I want to make a folder in the Internal Memory in my application to store Audio Files,then check if the exist to do some operations. How to make this folde, in which path, and how to retrieve these files again?

1条回答
等我变得足够好
2楼-- · 2019-01-14 10:26
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

For deleting a file from internal :

if (new File("path/to/file").delete()) {
  // Deleted
} else {
  // Not deleted
}
查看更多
登录 后发表回答