tags:

views:

40

answers:

2

I'm happy reading and writing to a pre-set file, and could manually populate a listview, but I'm hoping there is an official(or not) filebrowser I missed, or other more elegant solution to present the user with a directory listing, and let them select a file.

+1  A: 
final String state = Environment.getExternalStorageState();
if (Environment.MEDIA_MOUNTED.equals(state)) {
Files[] files = Environment.getExternalStorageDirectory().listFiles();
} else {
...
}
Damian Kołakowski
Looks good! I'll give it a go!
Chozabu
+1  A: 
File fileList = new File("/sdcard");
if (fileList != null){
    File[] filenames = fileList.listFiles();
        for (File tmpf : filenames){
            //Do something with the files
        }
    }
}

Is another method you can try

Kevin Grant
Looks like it'd work, but it's better to useEnvironment.getExternalStorageDirectory()overFile fileList = new File("/sdcard");in case it is called something other than "sdcard"
Chozabu