Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

reading a specific file from sdcard in android

Tags:

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); 
like image 225
sajjoo Avatar asked Sep 23 '10 15:09

sajjoo


1 Answers

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.

File dir = Environment.getExternalStorageDirectory(); File yourFile = new File(dir, "path/to/the/file/inside/the/sdcard.ext"); 
like image 118
Cristian Avatar answered Sep 30 '22 19:09

Cristian