本文介绍了在内存中创建文件夹以保存文件并在以后检索它们的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在我的应用程序的内存中创建一个文件夹来存储音频文件,然后检查是否存在以进行一些操作.如何制作这个文件夹,在哪个路径下,如何重新找回这些文件?
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?
推荐答案 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用于从内部删除文件:
if (new File("path/to/file").delete()) { // Deleted } else { // Not deleted }更多推荐
在内存中创建文件夹以保存文件并在以后检索它们
发布评论