Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Posts: 103
Registered: ‎12-12-2011
My Device: Developer
My Carrier: Robosoft

Retieve image from gallery in BB phone.

Hello all,


I am developing an application where I need to get an image from the gallery (i.e. Pictures folder) in BB device programmatically and then set the image in BitmapField as thumbnail. Can someone suggest the way to do this.

I am developing the app for OS versions 4.6 and above, for touch and non-touch devices.


Thanks in advance.

Posts: 1,807
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-, Z10 (STL100-3)-, Z30 (STA100-5)-, Passport (SQW100-1)-, PlayBook (16GB)-
My Carrier: Verizon

Re: Retieve image from gallery in BB phone.

Simple list of steps:

  1. Determine file path (use System.getProperty to find the pictures folder)
  2. Open FileConnection to picture.
  3. Get InputStream
  4. Use IOUtilities to read all the data.
  5. Close InputStream
  6. Close FileConnection
  7. Create a Bitmap with the data (Bitmap.createBitmapFromBytes)
  8. Create BitmapField with Bitmap
  9. Display
---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.