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