08-18-2010 10:20 AM
I guess you need to put your image under src\resources folder.
08-18-2010 10:26 AM
This guy just got that to work: http://supportforums.blackberry.com/t5/Java-Develo
Maybe your resource is out of sync or not in some accessible namespace?
Brandon
08-18-2010 11:04 AM
I take it you have reviewed this:
http://supportforums.blackberry.com/t5/Java-Develo
Note these lines:
Note: Images added to a project are automatically converted into the Portable Network Graphics (PNG) format when the application is built into a .cod file. This can cause an issue when adding an animated GIF because this process will strip out the animation. There are two workaround options for this issue. The first is to open the Project Properties for your application in the BlackBerry® Java® Developement Environment (BlackBerry JDE), click on the compile tab and check the Don’t convert image files to png checkbox. This will prevent all images in the application from being converted, which can be inefficient if you have images in formats other than GIF and PNG in your project. The workaround for an individual image is to change the extension of your GIF image from .gif to something else (such as .bin). This will prevent the RIM Application Program Compiler (RAPC) from converting the image into a .png.
I don't think that is all of your problem mind you, but this may help.
08-18-2010 11:47 AM
@peter I think on (at least in Eclipse) on some newer builds they actually reversed that. Now the option is if you want rapc to convert all images to PNGs.
Now back to the nitinverma274; as @mblorenz said, GIF is not the same as JPG. Possible reasons for getting a null pointer is, as stated previously, GIF != JPG, the file isn't actually part of the project (it happens to the best of us sometimes), as @peter said it is getting converted to PNG, or you meant "globe.gif" not "globe.jpg".
Those are you for options for why it you are getting a null pointer because the AnimatedGIFField is a somewhat commonly used field so I think someone would have had that problem before if it was the field.
Now I'm thinking ahead, since you are desperate to get this done.
08-18-2010 11:53 PM
@arkadyz: I am not using the Eclipse. I have not any src folder.
I am USing the JDE 5.0(IDE) for coding.
@Peter: Yup I am USing that type of code as u suggest.
But the Problem is same. that globe.gif not found.
This is the alst part Of my Application. I have complete all the work.
Rest part of the Application is tis Spinnable globe.
I am not understand that what should i do.
08-18-2010 11:54 PM
hey did u tried this:
GIFEncodedImage image; EncodedImage encodedImage=EncodedImage.getEncodedImageResource("a.gif"); byte data[] = new byte[4000]; data = encodedImage.getData(); image =(GIFEncodedImage) EncodedImage.createEncodedImage(data,0,data.length ); AnimatedGIFField animatedGIF = new AnimatedGIFField(image);
08-18-2010 11:56 PM
Thanks Swati for coming back to help me. Thank u so much.
I will try this which u suggest me.and back u soon.
08-19-2010 12:44 AM
Hey Swati, I did as u suggest, Now the code is below,
GIFEncodedImage image;
EncodedImage encodedImage=EncodedImage.getEncodedImageResource( "globe.gif");
byte data[] = new byte[4000];
data = encodedImage.getData();
image =(GIFEncodedImage) EncodedImage.createEncodedImage(data,0,data.length );
AnimatedGIFField loadimg = new AnimatedGIFField(image,0);
//this.add(loadimg);
But the same Problem still there.
Then I debug the code then I found that line where the Problem
that is----
data = encodedImage.getData();
And the Error is could not found globe.gif
08-19-2010 01:25 AM
Above Problem is Solved but Image not Displaying on the Screen.
08-19-2010 01:27 AM
But Screen taking some Place on the screen. but not displaying.