views:

97

answers:

1

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);
+1  A: 

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");
Cristian