Search code examples
imageblackberryjava-mephotos

Fetch all Image names from blackberry Device


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


Solution

  • Using System.getProperty(String key) it is possible to get image storage dirs on device:

    1. Key "fileconn.dir.memorycard.photos". Returns default directory for storing photos on SD Card. It should be something like "file:///SDCard/BlackBerry/pictures/".

    2. 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.