I want to make an image browser for my application where the user can select the image that he wants from the phone. I am reading each image from the phone like this:
FileConnection fileConnection = (FileConnection)Connector.open((String) imm.elementAt(i));
InputStream inputStream = fileConnection.openInputStream();
byte[] imageBytes = new byte[(int)fileConnection.fileSize()];
inputStream.read(imageBytes);
inputStream.close();
fileConnection.close();
EncodedImage image = EncodedImage.createEncodedImage(imageBytes, 0, -1);
EncodedImage image1 = scaleImageEncoded.scaleImage(image, (int) (Display.getWidth() / 4) - 10, (int) (Display.getWidth() / 4) - 10);
BrowseBitmapField field = (BrowseBitmapField) manager.getField(i);
field.setBitmap(image1.getBitmap());
field.setEncodedImage(image);
When the phone included many images, this process bicomes too slow and the phone needs a lot of time to get them. Is there any faster way to read an image from the memory of the phone and display it?
Thanks in advance
The guy who posted at the below URL figured out you can get the thumbnail from BBThumbs.dat and posted some code. I haven’t tried it myself but if it works the time savings should be very significant.
http://supportforums.blackberry.com/t5/Java-Development/Thumbnails-work-around/td-p/343870