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: 89
Registered: ‎09-03-2009
My Device: Not Specified

Application very slow in real BlackBerry

I have install my appllication into real device (BB Jave), I am using list field to display data from persistent store. I have problem each time I scroll over list field is really slow.


This is my code :


public void drawListRow(ListField listField, Graphics graphics, int index,
		int y, int width) {
		graphics.drawBitmap(0, y, Bitmap.getBitmapResource("Images/GreyList.jpg").getWidth(), Bitmap.getBitmapResource("Images/GreyList.jpg").getHeight(), Bitmap.getBitmapResource("Images/GreyList.jpg"), 0, 0);

	else {
		graphics.drawBitmap(0, y, Bitmap.getBitmapResource("Images/WhiteList.jpg").getWidth(), Bitmap.getBitmapResource("Images/WhiteList.jpg").getHeight(), Bitmap.getBitmapResource("Images/WhiteList.jpg"), 0, 0);

	String text = itemList[index];
	graphics.drawText(text, 30, y, 0, width);


 How to solve this ?




Posts: 562
Registered: ‎09-30-2009
My Device: Not Specified

Re: Application very slow in real BlackBerry

Are GreyList and WhiteList solid colours? If so, you should consider using graphics primitives to render colors, not images.


Consider getting the dimensions of the images only once, as drawListRow may be called more than once, I suspect.


How big are the images, size and dimension?

Posts: 23
Registered: ‎12-21-2009
My Device: 8800
My Carrier: Zain

Re: Application very slow in real BlackBerry

off course  it will be slow, you are getting the image resource three times in each draw!!.


cache the image and keeps using it


Bitmap image = Bitmap.getBitmapResource("Images/GreyList.jpg");



now in drawList:


graphics.drawBitmap(0, y, image.getWidth(), image.getHeight(), image, 0, 0);