在android中从sdcard读取特定文件
如何从SD卡读取特定文件。我已通过 DDMS 将文件推送到 SD 卡中,我正在尝试通过这种方式读取它,但这给了我例外。谁能告诉我如何准确指向该文件?
我的代码是这样的。
String path = Environment.getExternalStorageDirectory().getAbsolutePath();
FileInputStream iStream = new FileInputStream(path);
how to read a specific file from sdcard. i have pushed the file in sdcard through DDMS and i am trying to read it though this way but this give me exception. can anybody tell me how to point exactly on that file?
my code is this.
String path = Environment.getExternalStorageDirectory().getAbsolutePath();
FileInputStream iStream = new FileInputStream(path);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您正在尝试读取目录...您需要的是文件!做这样的事情......然后,你可以按照你想要的方式读取文件。
You are trying to read a directory... what you need is the file! Do something like this... then, you can read the file as you want.
要从外部存储读取任何文件(在我的例子中为 CSV),我们需要它的路径,一旦你有了路径,你就可以这样做......
To read any file(CSV in my case) from External Storage, we need a path for it,once you have path you can do like this...