文件列表保存到内部存储器 [英] List of files of saved to the internal storage
问题描述
我的Android应用程序节省一些统计数据的内部存储。每个文件名是APPNAME-的currentdate
My android application is saving some stats to internal storage. Each file name is in the format of "appname-currentDate"
我想知道:
1。当我保存到内部存储,是否有分配给我的应用程序特定的文件夹,或者是我的文件与在同一direcotry
1- When I save to internal storage, is there a specific folder assigned to my app, or are my files saved along with files from other applications in the same direcotry
2 - 有没有办法知道我的应用程序保存到内部存储器的文件列表
2- Is there a way to know the list of files saved by my application to the internal storage
感谢您这么多。
推荐答案
1)取决于您使用来获取文件句柄哪种方法。通常文件存储在应用特定的目录,如。 /数据/数据/ [your.package.name] / 。该目录中的文件只能通过读取你的应用程序。
1) Depends on which method you use to get the file handle. Normally files are stored in an application specific directory, eg. /data/data/[your.package.name]/. The files in that directory are only readable by your application.
2)使用 getFilesDir()方式在活动获得的文件操作和使用 listFiles()它来获得一个数组的文件再presenting应用程序中的数据文件夹中的所有文件。
2) Use the getFilesDir() method in your Activity to get a File handle and use the listFiles() on it to get an array of File representing all files in your application data folder.
延伸阅读: http://developer.android.com/guide /topics/data/data-storage.html
这篇关于文件列表保存到内部存储器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!