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: 25
Registered: ‎01-29-2009
My Device: Curve 8330
Accepted Solution

How to Change Height in Field Array of Bitmaps

Dear BB Developers,


I am working with a Field array (3x3) which I am filling with bitmap images.

I have loaded all 9 images successfully but I dont know how to resize the height of the rows so the images would fit.

Any help would be greatly appreciated.


Code snippet:

In the main routine:


Field[][] tableContent = new Field[3][3];

tableContent[0][0] = new BitmapField(TopLeft);


tableContent[2][2]= new BitmapField(BotRight);

int[] widths = {40, 40, 40};

int[] paddings = {20,20,20};

screen.add(new TableListField(tableContent, widths, paddings)) ;



outside the main routine..

private static final Bitmap TopLeft = Bitmap.getBitmapResource("topleft.jpg" );


private static final Bitmap BotRight = Bitmap.getBitmapResource("botright.jpg" );


class TableListField extends ListField

public TableListField(Field[][] contents, int[] columnWidths,
        int[] horizontalPaddings)
        int numRows = contents.length;

        // Create a row manager for each row.
        _rows = new TableRowManager[numRows];
        for (int curRow = 0;  curRow < numRows;  curRow++) {
            _rows[curRow] = new TableRowManager(contents[curRow]);

        _columnWidths = columnWidths;
        _horizontalPaddings = horizontalPaddings;



Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: How to Change Height in Field Array of Bitmaps

I presume your RENDERER takes the three images for each row and displays these across the Row using a drawBitmap(....) for each?


Anyway, the height of the row in the ListField is controlled by the ListField.setRowHeight() method.  You probably want to replace this:


screen.add(new TableListField(tableContent, widths, paddings)) ;




TableListField tabList = new TableListField(tableContent, widths, paddings);

tabList.setRowHeight(TopLeft.getHeight() + 1);



Hope this helps.

Posts: 25
Registered: ‎01-29-2009
My Device: Curve 8330

Re: How to Change Height in Field Array of Bitmaps

Thank you ! It worked.