saj*_*joo 22 android file android-sdcard
如何从SD卡读取特定文件.我已经通过DDMS在sdcard中推送文件,我试图通过这种方式阅读它,但这给了我一个例外.任何人都可以告诉我如何准确指出该文件?
我的代码就是这个.
String path = Environment.getExternalStorageDirectory().getAbsolutePath();
FileInputStream iStream = new FileInputStream(path);
Run Code Online (Sandbox Code Playgroud)
Cri*_*ian 47
您正在尝试阅读目录...您需要的是文件!做这样的事情......然后,你可以根据需要阅读文件.
File dir = Environment.getExternalStorageDirectory();
File yourFile = new File(dir, "path/to/the/file/inside/the/sdcard.ext");
Run Code Online (Sandbox Code Playgroud)