Sunday, August 2, 2009
How to Animate GIF Image in Blackberry
For animating a gif image in bb screen follow the steps:
-------------------------------------------------------------------------------
1. Add the gif image (ex. myImage.gif) in the project (Right Click on the Project -> Add File to Project...).
2. Images added to a project are automatically converted into the Portable Network Graphics (PNG) format when
the application is built into a .cod file.
3. This problem can be resolved by any of the following approach:
a. rename the gif image as *.bin (myImage.bin) and then add in the project
b. Project Properties -> Compile Tab -> Check Don't convert image files to PNG
4. Load the image into GIFEncodedImage
GIFEncodedImage image;
EncodedImage encodedImage = EncodedImage.getEncodedImageResource("myImage.bin");
byte data[] = new byte[4000];
data = encodedImage.getData();
image =(GIFEncodedImage) EncodedImage.createEncodedImage(data,0,data.length);
5. Create a AnimatedGIFField using the GIFEncodedImage
AnimatedGIFField animatedGIF = new AnimatedGIFField(image);
6. Finally add the field into the screen and get gif image animated.
add(animatedGIF);
Subscribe to:
Post Comments (Atom)
"AnimatedGIFField" link is not working.
ReplyDelete