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.
views:
40answers:
2
+1
A:
final String state = Environment.getExternalStorageState();
if (Environment.MEDIA_MOUNTED.equals(state)) {
Files[] files = Environment.getExternalStorageDirectory().listFiles();
} else {
...
}
Damian Kołakowski
2010-09-15 09:23:21
Looks good! I'll give it a go!
Chozabu
2010-09-15 10:17:21
+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
2010-09-15 11:44:28
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
2010-09-15 16:47:33