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
Posts: 91
Registered: ‎06-21-2011
My Device: Blackberry Torch 9800
My Carrier: developer
Accepted Solution

set background image to PopUpScreen

Hi guys,

are there any way to set background image to  PopUpScreen?

I 'd tried to do that like this :


public class AddContactDialog extends PopupScreen

{

protected void paint(final Graphics graphics) {
        EncodedImage ei = EncodedImage.getEncodedImageResource(AppSettings.AddContactAlertView);
        Image im = Image.createImage(ei.getData(),0,ei.getLength());
        graphics.drawImage(im, 0, 0, 0);
}

}

Regards,
Arsen
Developer
Posts: 19,633
Registered: ‎07-14-2008
My Device: Not Specified

Re: set background image to PopUpScreen

You need to override the paint method of the Manager that you use when you create the PopupScreen - look at the constructor for this class.

 

I would recommend that you override paintBackground rather than paint.

 

Also if you do override paint, remember to call super.paint(), if you expect anything else (like the Fields you have added) to actually display> 

 

Can I finally recommend that you create the bitmap once and not every time you go through paint.  Converting a file into a Bitmap is an expensive operation. 

Developer
Posts: 91
Registered: ‎06-21-2011
My Device: Blackberry Torch 9800
My Carrier: developer

Re: set background image to PopUpScreen

[ Edited ]

OK,sorry I didn't mention it but java import

 

import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;


packages which I didn't notice and thats why I wasn't able to see graphics.drawbitmap,instead it shows microedition graphics fuctions.

However I found interesting link here : http://supportforums.blackberry.com/t5/Java-Development/Popup-Screen-cannot-display-a-picture/td-p/...

Regards,
Arsen