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
BlackBerry Development Advisor
MSohm
Posts: 14,671
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook

Custom gauge Field like spinning icon

Quote from the previous forum:


arjunsiripurapu@gmail.com

Posts: 9
Registered: Apr, 2008

Custom gauge Field like spinning icon
Posted: Jul 22, 2008 8:33 AM
 


Hi all,

I want to use spinning icon, while GPS is try to get the current location latitude, longitude for the current location. To get the Current location from the GPS receiver, it is taking around 15 to 20 seconds to fetch the current location information.Meanwhile I want to show a progress bar like spinning icon. Can any one help me in this issue.


thanks in advance.

Please have a look at the following developer knowledge base articles for some examples on how you could do this.

 

How To - Display a progress bar in handheld applications
Article Number: DB-00121

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800505/800345/...

 

How To - Display an animated GIF
Article Number: DB-00652

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800505/800345/...

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
New Developer
arjun
Posts: 8
Registered: ‎07-23-2008
My Device: Not Specified

Re: Custom gauge Field like spinning icon

Hi msohm,

 

         Thanks for your reply.

   

        I used the AnimatedGIFField class to get the spinning icon in my application. but when i am calling this instance, it is showing  ClassCastException or  if remove the casting, it is throwing NullPointerException. I couldn't  solve this  problem. Here  is the code what I am writing,

 

         GIFEncodedImage image;
         EncodedImage encodedImage = EncodedImage.getEncodedImageResource("wait30trans.gif");
         byte data[] = encodedImage.getData();
         try {
                    image =(GIFEncodedImage) EncodedImage.createEncodedImage(data,0,data.length);
          }catch(Exception ex){
          }
         

         AnimatedGIFField animatedGIF = new AnimatedGIFField(iamge); 

  

      How to create GIFEncodedImage, how to get the  byteArray of  an image in my Application.

      wait30trans.gif is a resource in my Appliciton.

      

      Can any one please help me in this issue.

 

      Thanks in advance. 

       
 

 

 

Please use plain text.
Developer
ianstrain
Posts: 62
Registered: ‎07-15-2008
My Device: Not Specified

Re: Custom gauge Field like spinning icon

Is it possible to display the gaugeField having an indefinite progress like the Gauge class in MIDP?

 

e.g.

 

Gauge gauge = new Gauge( null, false, Gauge.INDEFINITE, Gauge.CONTINUOUS_RUNNING );

 

This will display an hour glass when used in a MIDlet on a blackberry device.

 

 

Please use plain text.
BlackBerry Development Advisor
MSohm
Posts: 14,671
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook

Re: Custom gauge Field like spinning icon

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. A workaround to this is to change the extension of your GIF image from .gif to something else (such as .bin). This will prevent rapc from converting the image into a .png.

 

You can create a thread that modifies the GaugeField's value (progress).  This can allow you to keep filling the progress bar.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
Developer
richard_puckett
Posts: 191
Registered: ‎04-03-2008
My Device: Bold 9700

Re: Custom gauge Field like spinning icon

Can this also be achieved by (in the JDE) going to project properties -> Compile tab and checking "Don't convert image files to png"?
Please use plain text.
BlackBerry Development Advisor
MSohm
Posts: 14,671
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook

Re: Custom gauge Field like spinning icon

Yes, this can accomplish the same thing, but does affect all images within an application.  If you want individual control over each image then renaming the extension allows this.
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
New Developer
arjun
Posts: 8
Registered: ‎07-23-2008
My Device: Not Specified

Re: Custom gauge Field like spinning icon

 Hi all,

        my  problem not yet solved. If i am converting the Encoded image like this

 

GIFEncodedImage iamge = (GIFEncodedImage)EncodedImage.createEncodedImage(data,0,data.length);

 

      it is throwing NullPointer Exception in AnimatiedGIFFiled  at  super(image.getBitmap(), style);

 

 If i remove GIFEnodedImage from the abaove line like this 

 

  GIFEncodedImage iamge = EncodedImage.createEncodedImage(data,0,data.length);

  

   it is throwing  compile time exception.

 

D:\BB\Animation\AnimationMain.java:38: incompatible types
found   : net.rim.device.api.system.EncodedImage
required: net.rim.device.api.system.GIFEncodedImage
          GIFEncodedImage iamge = EncodedImage.createEncodedImage(data,0,data.length);
                                                                 ^
1 error

 

can any one please help me to  sort this issue.

 

 

Thanks in advance. 

Please use plain text.
BlackBerry Development Advisor
MSohm
Posts: 14,671
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook

Re: Custom gauge Field like spinning icon

Please verify that your data byte array is not null used in the createEncodedImage is not null.
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
Developer
someswararao
Posts: 40
Registered: ‎07-16-2008
My Device: Not Specified

Re: Custom gauge Field like spinning icon

Hi,

 

I am also tried this...

 

i am shure that data array is not null.

 

it is giving the problem at the time of casting...in the below line.

image =(GIFEncodedImage) EncodedImage.createEncodedImage(data,0,data.length);

 

Please let me know..

no one is working either Gauge or this...

 

 

 

Please use plain text.
BlackBerry Development Advisor
MSohm
Posts: 14,671
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook

Re: Custom gauge Field like spinning icon

Have you tried a different GIF file?  Maybe there is an issue with the one you are using.
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.