如何從SD卡讀取特定文件。我已經通過DDMS在sdcard中推送了文件,盡管嘗試通過這種方式讀取它,但這給了我例外。有人可以告訴我如何精確指向該文件嗎?我的代碼是這樣的。String path = Environment.getExternalStorageDirectory().getAbsolutePath();FileInputStream iStream = new FileInputStream(path);
2 回答

繁星淼淼
TA貢獻1775條經驗 獲得超11個贊
您正在嘗試讀取目錄...您需要的是文件!做這樣的事情...然后,您可以根據需要讀取文件。
File dir = Environment.getExternalStorageDirectory();
File yourFile = new File(dir, "path/to/the/file/inside/the/sdcard.ext");
- 2 回答
- 0 關注
- 755 瀏覽
添加回答
舉報
0/150
提交
取消