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
maanbhati
Posts: 236
Registered: ‎07-28-2010
My Device: Not Specified

how to do Badge implementation in bb

Hi All,

             I m new to bb java development , i want ti implement badge implementation in bb java app, means i want add one button on top right corner of another  button. coding wiil be apriciated.

 

 

Thnaks to All

Please use plain text.
Developer
hemant_sain
Posts: 180
Registered: ‎12-09-2011
My Device: 9360, BB10

Re: how to do Badge implementation in bb

i think u have to use the images means use the bitmap and implement the listner on them.

It will be easy rather than button.

Please use plain text.
Trusted Contributor
maanbhati
Posts: 236
Registered: ‎07-28-2010
My Device: Not Specified

Re: how to do Badge implementation in bb

Ok I will use image but how i will add another image on top right corner of first image.
Please use plain text.
Developer
Dionysus
Posts: 152
Registered: ‎07-28-2011
My Device: Bold 9900

Re: how to do Badge implementation in bb

You don't add another image on top of the current one, you simply replace it will another image.

 

if you are talking about the application icon, you would have to do this from OS 5 and lower. However, if you are developing for OS6 and up, you can just call HomeScreen.setNewState(true, yourAppDescripter) ... That's only if you're talking about the application icon.

Please use plain text.
Developer
hemant_sain
Posts: 180
Registered: ‎12-09-2011
My Device: 9360, BB10

Re: how to do Badge implementation in bb

Use this code or add more in it according to your requirement.

 

public class CustomButtonField extends MainScreen 
{
	public CustomButtonField() 
	{
		add(new CustomButton());
	}
}



public class CustomButton extends Field
{
	Bitmap bmp = Bitmap.getBitmapResource("redBg.png");
	Bitmap bmpDefault = Bitmap.getBitmapResource("callout_bg.png");
	
	protected void layout(int width, int height) 
	{
		setExtent(bmpDefault.getWidth(), bmpDefault.getHeight());
	}

	protected void paint(Graphics graphics) 
	{
		graphics.drawBitmap(0, 0, bmpDefault.getWidth(), bmpDefault.getHeight(), bmpDefault, 0, 0);
		graphics.drawBitmap(200, 0, bmp.getWidth(), bmp.getHeight(), bmp, 0, 0);
	}

}

 

Please use plain text.