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
New Contributor
Posts: 6
Registered: ‎08-25-2011
My Device: 9800
My Carrier: blackberry

Rating Bar in Black berry

Hi Experts,

                            I am going to impliment an UI is should have rating bar like 5 stars for reviews based on the rating value. Rating Value i am getting from the backend but i want to build the rating bar based on this value. So please help me on this regard...

 

give me the valuable sugguestions from all....

 

Thanks,

Siva

Developer
Posts: 80
Registered: ‎06-06-2011
My Device: bold 9000
My Carrier: airtel

Re: Rating Bar in Black berry

Hi,

 

Im no expert but i think the below link would be use full for you to implement the rating star.

 

http://supportforums.blackberry.com/t5/Java-Development/Implement-advanced-buttons-fields-and-manage...

 

In the above link you will find the rating field where they have all the code required.

 

Any doubts do post again.

 

let me know if it was helpfull.

 

Regards

Krishnan.

New Contributor
Posts: 6
Registered: ‎08-25-2011
My Device: 9800
My Carrier: blackberry

Re: Rating Bar in Black berry

Thanks for the valuable value.

 

But it is not the one i am expecting because it will allows the user to give rating. But i need to get the star rating from the backend value. Please give me any suggestions.

 

 

Developer
Posts: 80
Registered: ‎06-06-2011
My Device: bold 9000
My Carrier: airtel

Re: Rating Bar in Black berry

Hi,

 

Omplement the same and set the value into it. thats it.

 

Try it. it must be possible.

 

Regards

Krishnan.

New Contributor
Posts: 6
Registered: ‎08-25-2011
My Device: 9800
My Carrier: blackberry

Re: Rating Bar in Black berry

 

Can you please send the sample code if you have ...

Highlighted
Developer
Posts: 80
Registered: ‎06-06-2011
My Device: bold 9000
My Carrier: airtel

Re: Rating Bar in Black berry

sample code is

 

NegativeMarginVerticalFieldManager ratingManager = new NegativeMarginVerticalFieldManager( VERTICAL_SCROLL|USE_ALL_WIDTH  ) {         

  protected void paintBackground( Graphics g )           

{                int oldColor = g.getColor();               

try {                   

g.setColor( 0xecf2f7 );

                    g.fillRect( 0, getVerticalScroll(), getWidth(), getHeight() ); 

              }

finally {  g.setColor( oldColor );}

            }

          };

 

 

RatingField rating = new RatingField( Bitmap.getBitmapResource( "rating_star.png" )               ,Bitmap.getBitmapResource( "rating_dot.png" )

                , Bitmap.getBitmapResource( "rating_star_focus.png" ) 

             , Bitmap.getBitmapResource( "rating_dot_focus.png" )

                , 5, 4, Field.FIELD_HCENTER );     

 

  rating.setMargin( 7, 0, 15, 0 );

 

ratingManager.add( rating );

 

From the link that i had provided to you earlier you can download that file which is availabel in the bottom.

 

In that you will have to take two files or classes.

1)NegativeMarginVerticalFieldManager 

2)RatingField

 

Images will also be available in that file itself. under rating folder.

 

after implementing that code try this.

 

rating.setValue(int num);

 

where num will be the value that you recieved from web service.

 

Regads

Krishnan.

 

 

New Contributor
Posts: 6
Registered: ‎08-25-2011
My Device: 9800
My Carrier: blackberry

Re: Rating Bar in Black berry

Hi Krishnan,

 

I written as you said but it is showing blank screen with the title.I written the code in MyScreen only rit. So give me some suggestions....

 

 

Developer
Posts: 80
Registered: ‎06-06-2011
My Device: bold 9000
My Carrier: airtel

Re: Rating Bar in Black berry

Can you post ur code so that i can see what you have done

 

Regard

Krishnan.