0
您好我是新来的android编程,有人可以告诉我如何访问目录中的文件,我使用Environment.getExternalStorageDirectory()方法吗?如何访问目录中的文件
您好我是新来的android编程,有人可以告诉我如何访问目录中的文件,我使用Environment.getExternalStorageDirectory()方法吗?如何访问目录中的文件
该方法只返回一个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.
感谢。对于访问内部文件是否一样,以及如何通过目录结构访问手机中的默认壁纸? – pranay 2010-06-11 15:39:54
那,我不知道。我从来没有真正在Android上使用Java,只是在桌面上。但是如果这些壁纸没有隐藏在目录结构中,我会很惊讶。 – Curtis 2010-06-11 18:42:43
好吧,我如何将文件添加到像我使用的内部目录: 意图我=新的意图(Intent.ACTION_PICK,android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI); 获取文件,但目前它显示没有找到媒体,所以我如何测试应用程序? – pranay 2010-06-12 04:19:02