I\'m wondering how to show files from a directory in a ListView`. The files can be listed with:
File dir = new File(dirPath);
File[] filelist = dir.listFiles
I guess you want to show the names of the files from that directory so you could try this:
File dir = new File(dirPath);
File[] filelist = dir.listFiles();
String[] theNamesOfFiles = new String[filelist.length];
for (int i = 0; i < theNamesOfFiles.length; i++) {
theNamesOfFiles[i] = filelist[i].getName();
}
The adapter to use with the list :
new ArrayAdapter(this, android.R.layout.simple_list_item, theNamesOfFiles);
For anything more complicated than showing the names of the files you have to implement a custom adapter.