问题
Is there any way to iterate through all images stored in a blackberry device. I have seen this example which iterates over the whole file system and scans each file. I am wondering is there any cheaper way of doing the same. Something that directly looks into the image directory? Thanks
回答1:
Using System.getProperty(String key)
it is possible to get image storage dirs on device:
Key "fileconn.dir.memorycard.photos". Returns default directory for storing photos on SD Card. It should be something like "file:///SDCard/BlackBerry/pictures/".
Key "fileconn.dir.photos". Returns default directory for storing pictures on device memory. It should be something like "file:///store/home/user/pictures/".
Knowing these locations you can just iterage images inside of them, rather than scanning the whole file system. It is possible to list images using the FileConnection API. Specifically take a look at list(String filter, boolean includeHidden)
method.
来源:https://stackoverflow.com/questions/8258612/fetch-all-image-names-from-blackberry-device