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.


  1. "AnimatedGIFField" link is not working.

  2. Its very interesting post, good job

    Videocon Telecom has slashed the National Roaming rates effective 1st May 2015 as per the TRAI’s guidelines.The drop in tariff is to the extent of 75% on Local and National SMS; 40% on Incoming calls; and 23% & 20% on STD & Local calls resp while roaming.