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
Developer
arkadyz
Posts: 2,268
Registered: ‎07-08-2009
My Device: various
My Carrier: various

Re: implement spinable globe in the BB

I guess you need to put your image under src\resources folder.

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!
Please use plain text.
Contributor
mblorenz
Posts: 20
Registered: ‎06-25-2010
My Device: Bold 9700
My Carrier: Cincinnati Bell

Re: implement spinable globe in the BB

This guy just got that to work: http://supportforums.blackberry.com/t5/Java-Development/How-do-I-repaint-a-gif-on-button-click/m-p/5... 

 

Maybe your resource is out of sync or not in some accessible namespace?

 

Brandon

Please use plain text.
Developer
peter_strange
Posts: 19,601
Registered: ‎07-14-2008
My Device: Not Specified

Re: implement spinable globe in the BB

I take it you have reviewed this:

 

http://supportforums.blackberry.com/t5/Java-Development/Display-an-animated-GIF/ta-p/445014

 

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. 

Please use plain text.
Developer
rcmaniac25
Posts: 1,804
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.2174, Z10 (STL100-3)-10.3.0.700 Dev OS, Z30 (STA100-5)-10.3.0.700 Dev OS, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: implement spinable globe in the BB

@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.

  • Is this for a touchscreen, trackpad, trackball device?
  • Is the user able to rotate the globe, does it rotate on its own, does the user select (say) a city/town/country/area/etc. and the globe move to it?
  • Does it need to have a smooth rotation (think Google Earth when zooming in) or can it be linear?
  • Is this the last element you need to implement (so the rest of the app's code is there and is just waiting to have the rotation/interaction/etc. code added) or is this the first part of the app?
---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.
Please use plain text.
Developer
nitinverma274
Posts: 950
Registered: ‎06-22-2010
My Device: 9550

Re: implement spinable globe in the BB

@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.

Please use plain text.
Developer
swati-srivastava
Posts: 282
Registered: ‎02-25-2010
My Device: curve,bold,storm
My Carrier: Verizon,AT&T

Re: implement spinable globe in the BB

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);

 

 

Please use plain text.
Developer
nitinverma274
Posts: 950
Registered: ‎06-22-2010
My Device: 9550

Re: implement spinable globe in the BB

Thanks Swati for coming back to help me. Thank u so much.

 

I will try this which  u suggest me.and back u soon.

Please use plain text.
Developer
nitinverma274
Posts: 950
Registered: ‎06-22-2010
My Device: 9550

Re: implement spinable globe in the BB

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
Please use plain text.
Developer
nitinverma274
Posts: 950
Registered: ‎06-22-2010
My Device: 9550

Re: implement spinable globe in the BB

Above Problem is Solved but Image not Displaying on the Screen.

Please use plain text.
Developer
nitinverma274
Posts: 950
Registered: ‎06-22-2010
My Device: 9550

Re: implement spinable globe in the BB

But Screen taking some Place on the screen. but not displaying.

Please use plain text.