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: 28
Registered: ‎09-24-2009
My Device: Not Specified
Accepted Solution

doPaint issues

Hi,

 

the app I'm developing has one full screen.

the UI is based on the screen's graphics manipulation (same as working with J2ME's Canvas).

 

until today I refreshed the whole screen using invalidate().

now I added an optimization in which I repaint only the "dirty" items.

It looks like invalidate() clears the field and repaints it, so I tried doPaint() instead. 

when using doPaint() the app never get into the paint() method.

 

what other alternative do I have? is there some kind of flush graphic to screen method?

 

thanks,

Guy

Developer
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: doPaint issues

You are probably looking for Screen.updateDisplay().

 

Highlighted
Developer
Posts: 28
Registered: ‎09-24-2009
My Device: Not Specified

Re: doPaint issues

thanks for the reply,

 

that did not work either.

 

instead I used the following code

 

public void drawScreen()
	{
		synchronized (UiApplication.getEventLock())
		{
			Graphics g = getGraphics();
			g.pushRegion(new XYRect(0,0,getWidth(),getHeight()));
			screen.paint(g);
			g.popContext();
		}
	}

 

and it works.

 

thanks