Question

Im trying to figure out the best way to get all the directories on a device that contain image files. I know how to use all the api's but my application calls for using an in app image gallery rather than just using an intent to launch the gallery. Ive thought of going through the entire device and looking in the directories and check for extensions but that would take a couple seconds to long. Does any one have a better solution? I already have a very solid custom gallery built but my only problem is coming up with a nice solution to get all the images in other places that my app wont know about.

Was it helpful?

Solution

apache commons-io DirectoryWalker

public class ImagesFinder extends DirectoryWalker{

protected boolean handleDirectory(File directory, int depth, Collection results) {
 return true; 
}

 protected void handleFile(File file, int depth, Collection results) {
      // 
}
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top