Welcome!

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

Reply
Regular Contributor
Posts: 70
Registered: ‎04-14-2010
My Device: bold 9000
Accepted Solution

how to load image to memory

i want to get jpg from my webcam

 

yesterday thanks to you

i loaded jpg to simulator

,but it was imported to java project res

 

how can i load jpg to memory and read it from memory in bb ?

 

if you know some post ,or do you know it

plz warm answer   T T

 

 

 

Developer
Posts: 19,612
Registered: ‎07-14-2008
My Device: Not Specified

Re: how to load image to memory

This article will tell you how to read the jpg in your project into memory.

 

How To - Add plain text or binary files to an application
Article Number: DB-00148
http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800620/How_To_...

Then you need to convert the bytes into something the BlackBerry can process.  To do this you use:

EncodedImage.createEncodedImage(..);

 

Now you get to get a Bitmap, which the form that the BlackBerry uses to display images on  the screen.  This encodedImage object you will have created in the previous step and be used to get the bitmap, just use the

getBitmap()

method

 

Now the BlackBerry display Fields on the screen, so you need to create a Field to display this, a BitmapField and tell it to use the bitmap you have just created.  This is easy, you just construct a new BitmapField:

BitmapField(Bitmap bitmap)

 

Finally you add the BitmapField to the screen you are displaying.

 

There are shorter ways of doing this if you create png rather than jpg images.