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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Developer
Raiden
Posts: 490
Registered: ‎07-16-2008
Accepted Solution

Bitmap Text Point

Hello guys'

 

I have little problem. This is : I created BitmapField then added to scree.

------------------------------------------

_bitmapScreen = new BitmapField();
           
            verMngr.add(_bitmapScreen);
            horMngr.add(verMngr);

------------------------------------------

 

Then load JPG image to BitmapField. It is working. 

 

Bitmap bitmap = createImage(data);

 

data  is byte massive : byte[] data;

 

Graphics graphics = new Graphics(bitmap);

int xOffset = (logo.getWidth() - Font.getDefault().getAdvance(logoString)) / 2;

int yOffset = (logo.getHeight() - Font.getDefault().getHeight()) / 2;

graphics.setColor(Color.WHITE);

graphics.drawText("TEXT" xOffset, yOffset);

 

Finally :

  _mapScreen._bitmapScreen.setBitmap(bitmap); this line doesn't work right?

 

 I think print text "TEXT" on bitmapField. But it didnt draw text.

 

Is there any solution ? guys

tnx

 

 

Please use plain text.
BlackBerry Development Advisor
shaque
Posts: 77
Registered: ‎07-14-2008

Re: Bitmap Text Point

Looks like a UI sync problem to me. As far as I understand this case, the image data for the BitmapField is updated but the BitmapField is not painted with the image.

 

Can you try to enclose the code below in an invokeLater() call? This method is defined in the UiApplication class. Please refer to the javadocs of UiApplication for more information.

 

Please use plain text.
Administrator
MSohm
Posts: 12,957
Registered: ‎07-09-2008
My Carrier: Bell

Re: Bitmap Text Point

Also note that you may need to call BitmapField.invalidate.  This causes the field to be redrawn.

 

Depending on where you call this from, you may need to wrap it as shaque described.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Found a bug? Report it using the Issue Tracker
Please use plain text.
Developer
Raiden
Posts: 490
Registered: ‎07-16-2008

Re: Bitmap Text Point

Tnx a lot' guys' I found my mistake.
Please use plain text.