read file from external storage

Kat picture Kat · Dec 3, 2011 · Viewed 34k times · Source

I simply cannot find how to get one specified file from the external storage. I know that with getExternalStoragePublicDirectory(), you get the external storage directory but I can't get further. I need some kind of method where you have to give the name of the file and it returns the file. Thanx

Answer

J. B. Rainsberger picture J. B. Rainsberger · Nov 12, 2012

Better than using File.separator is this, which is standard Java:

final File file = new File(Environment.getExternalStorageDirectory()
                          .getAbsolutePath(), filename);