Get a list of files from the external storage directory, and iterate said list. This should allow you to see if the extension matches pdf and then add to a list or whatever you want to do:
File[] file = Environment.getExternalStorageDirectory().listFiles();
for (File f : file){
if (f.isFile() && f.getpath().endswith(".pdf")) {
//Add to your list
}
}
This wont go inside directories as far as I know, so you'll need to wrap it inside a method and do something like if f.isDirectory()
re-call the method again to walk through the folder.
public void recursiveScan(File f) {
File[] file = f.listFiles();
for (File f : file){
if (f.isDirectory()) recursiveScan(f);
if (f.isFile() && f.getpath().endswith(".pdf")) {
//Add to your list
}
}
}
Which would be called something like recursiveScan(Environment.getExternalStorageDirectory());
Disclaimer:
I haven't tested it, so some stuff may be off, but it should give you a general idea of how to get to do it.