BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 03-31-2009, 02:07 AM   #1 (permalink)
Thumbs Must Hurt
 
Join Date: May 2007
Location: berlin, germany
Model: 8310
PIN: N/A
Carrier: vodafone
Posts: 163
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default setting row height in ObjectListField

Please Login to Remove!

Hi,
i have got a problem by setting the row height in a ObjectListField.
After i create a new instacne of an ObjectListField I set the row height by this code line:
Code:
 c = new ListField();     
c.setRowHeight(75);
callback = new ListCallback();
c.setCallback(callback);
but th height is always the same, so I take a look at the callback:
Code:
public class ListCallback extends ObjectListField implements ListFieldCallback{
 private Vector listElements = new Vector();
 public void drawListRow(ListField list, Graphics g, int index, int y,int w) {
  String text = (String)listElements.elementAt(index);
  setRowHeight(index,75);
   //...
And now the row height has changed. Great !!

But now I want to do this on BlackBerry 8900 with Java 4.6, and there I get an error (at red line) while adding some new Items to my ObjectListField:
Code:
public void updateList(String _view, boolean _init) {     
        Vector vDummy = loadData();        
        DataList.removeAllElements();
        for (int i = 0; i < vDummy.size(); i++) DataList.addElement(vDummy.elementAt(i));
    
        UiApplication.getUiApplication().invokeLater(new Runnable(){  
            public void run() {
                        try {
                            // liste leeren
                            while(c.getSize() > 0) {
                                c.delete(0);
                                callback.listElements.removeElementAt(0);
                            } 
                           
                            for(int i = 0; i < DataList.size(); i++) {
                                    c.insert(i);
                                    callback.insert("",i);
                            }
                            c.invalidate();
So the list seams to be blank. So how do I change the row height? Is there an easier way, maybe??

thanks hibbert
__________________
My English is so bad, that makes me nobody so quickly after
Offline  




Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.