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
Trusted Contributor
Posts: 176
Registered: ‎04-12-2012
My Device: Bold 9780 & Curve 8250
My Carrier: vodacom
Accepted Solution

Btitmap Select and unselect (Star Rating)

[ Edited ]

Hi All 

Im creating a star rating function ,I am Trying to do the same as the following:

http://supportforums.blackberry.com/t5/Java-Development/Create-rating-field/m-p/331060#M59732

 

I have achieved to select the Bitmap Field and then the bitmap changes, but how do I unselect the bitmap?

Small Code Sample:

 

Star1 = new BitmapField(StarNotClickedBitmap, BitmapField.FOCUSABLE){
protected boolean navigationClick(int status, int time){
Bitmap StarClicked = Bitmap.getBitmapResource("rating_star_focus.png");
Star1.setBitmap(StarClicked);
return true;
}
};

 

I tried using the following:

 

Star5 = new BitmapField(StarNotClicked, BitmapField.FOCUSABLE){
protected boolean navigationClick(int status, int time){
Bitmap StarClicked = Bitmap.getBitmapResource("rating_star_focus.png");
Star5.setBitmap(StarClicked);
return true;

}

 

protected boolean navigationUnclick(int arg0, int arg1) {
// TODO Auto-generated method stub
Bitmap StarNotClicked = Bitmap.getBitmapResource("rating_star.png");
fieldChangeNotify(0);
Star5.setBitmap(StarNotClicked);
return super.navigationUnclick(arg0, arg1);
}

};

 

But this does not work correctly, Am I writting the code in the incorrect order or am i completely off base, Please Help me! 

 

Thank you

Developer
Posts: 96
Registered: ‎06-05-2012
My Device: Developer
My Carrier: Developer

Re: Btitmap Select and unselect (Star Sating)

Trusted Contributor
Posts: 176
Registered: ‎04-12-2012
My Device: Bold 9780 & Curve 8250
My Carrier: vodacom

Re: Btitmap Select and unselect (Star Sating)

[ Edited ]

when I add the following (lets say i added 5 star fields and added the navigationClick to each star field):

    Star1 = new BitmapField(StarNotClicked, BitmapField.FOCUSABLE){
        protected boolean navigationClick(int status, int time){
            Bitmap StarClicked = Bitmap.getBitmapResource("rating_star_focus.png");
            Star1.setBitmap(StarClicked);
            return true;
        }

       protected boolean navigationUnclick(int status, int time) {
           // TODO Auto-generated method stub
           Bitmap StarNotClicked = Bitmap.getBitmapResource("rating_star.png");
           fieldChangeNotify(0);
           Star5.setBitmap(StarNotClicked);
           return super.navigationUnclick(status,time);
      } 
};

then when i "Unclick" on the first star field, starfield 5 unclicks, but when i set the unclick method to starfield 1 then if I click on starfield 1 once then it clicks and unclicks automatically with only clicking on it.

Trusted Contributor
Posts: 176
Registered: ‎04-12-2012
My Device: Bold 9780 & Curve 8250
My Carrier: vodacom

Re: Btitmap Select and unselect (Star Sating)