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

Posts: 39
Registered: ‎03-20-2009
My Device: Not Specified

Which is faster for UI: Blackberry UI API or J2ME Canvas API

Hi All,


I have a question. Which is the faster in drawing on blackberry devices: BB UI API or J2ME Canvas API. I have heard that J2ME provides GameCanvas which has the capability of  flushing the off screen buffer content from out side of paint method. That means if you want to update the screen you don't have to wait till paint method called. On otherhand, for BB you can only call invalidate() to update your display and that is not at instance call to paint method.But since its BB's native UI, it may be faster than GameCanvas (although I am not sure). Please advice what to choose for graphics programming.




Posts: 1,477
Registered: ‎12-30-2008
My Device: Torch 9810

Re: Which is faster for UI: Blackberry UI API or J2ME Canvas API

[ Edited ]

A combination of BlackBerry and J2ME APIs should be your choice ...




PS. Even if it is J2ME API, it is implemented in Blackberry devices, by RIM alone and not SUN Smiley Tongue 


EDIT: I didn't know it was about graphics, am I sleepy when replied this thread Smiley Tongue 

Message Edited by mantaker on 04-03-2009 03:35 PM
Manimaran Selvan
Co-Founder, Tech Lead,
Equity Markets Research Group
Posts: 17,024
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Which is faster for UI: Blackberry UI API or J2ME Canvas API

the blackberry ui and j2me canvas should not be mixed.

i don't think there will be big differences if you access low-level. personally i would go with the blackberry classes, they are more versatile and offer a far better integration with the special features of the device.
if you want to port an existing app or code for different j2me devices take the more limited, but generalized approach.
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Posts: 558
Registered: ‎11-25-2008
My Device: Not Specified

Re: Which is faster for UI: Blackberry UI API or J2ME Canvas API

It's a matter of portability mostly.


The J2ME classes will be portable to other phones. However, much of this code probably comes ready coded with a set of JNI (C functions) to be ported to the Qualcomm chip in the phone by whomever provides RIM with their JVM.

However, the Blackberry classes will be implemented by RIM themselves. So, I'd guess that using the RIM classes are faster, as they probably use the GPU to implement triangle fills and so forth. They also have functionality that isn't availble in the regular J2ME. For example, there is no polygon fill function in J2ME, but in the Blackberry Graphics class, they have functions like drawFilledPath that will draw and fill a polygon.


I've posted a few helper posts giving tips related to some of this and some of the missing math functions that are available in the Blackberry classes.


If given the option, use the blackberry classes, as they are faster and more powerful with a lot more functionality.


If you want portability, stick to the J2ME classes.


If you are doing graphics, you shouldn't mix the J2ME and Blackberry classes related to canvas and screen and so forth, but you can use J2ME bluetooth discovery classes for example at the same time as using blackberry graphics classes.


i.e. Be careful that you don't mix J2ME drawing and Blackberry drawing, as you can get really lost....


Hope that helps.