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

编程入门 行业动态 更新时间:2024-10-24 12:21:33
本文介绍了在内存中创建文件夹以保存文件并在以后检索它们的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

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 }

更多推荐

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

本文发布于:2023-05-26 19:32:29,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/265257.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:并在   文件夹   保存文件   内存

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!