Creating folder in internal Memory to save files and retrieve them later

走远了吗. 提交于 2019-11-26 20:33:15

问题


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:


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
}


来源:https://stackoverflow.com/questions/8493642/creating-folder-in-internal-memory-to-save-files-and-retrieve-them-later

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!