如何访问目录中的文件

时间:2010-06-11 14:22:47

标签: android

嗨,我是Android编程的新手,有人可以告诉我如何访问目录中的文件,我使用的是Environment.getExternalStorageDirectory()方法吗?

1 个答案:

答案 0 :(得分:3)

该方法只返回java.io.File,因此您应该能够使用标准Java方法获取文件:

 String[] list(); //Returns an array of strings with the file names in the directory represented by this file.
 String[] list(FilenameFilter filter); //Gets a list of the files in the directory represented by this file.
 File[] listFiles(FileFilter filter); //Gets a list of the files in the directory represented by this file.

http://developer.android.com/reference/java/io/File.html