BlackBerry Forums Support Community               

Closed Thread
LinkBack Thread Tools
Old 09-07-2010, 09:04 AM   #1 (permalink)
New Member
Join Date: Aug 2010
Model: 9000
Carrier: orange
Posts: 11
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Objectlistfield implementation

Please Login to Remove!


im trying to use objectlistfield and operate callback function drawListRow,
as you can see the code it does work but when the class myListField was in diffrent file it did not work!
does anyone please help me out and explain why?

* <your company here>, 2003-2008
* Confidential and proprietary.
package applicationUIPkg;

import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.ui.FieldChangeListener;
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.DrawStyle;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.component.ListField;
import net.rim.device.api.ui.DrawStyle;
import net.rim.device.api.ui.component.ButtonField;
import net.rim.device.api.ui.component.*;
import java.util.Vector;
import net.rim.device.api.ui.Graphics;
import net.rim.device.api.ui.Font;
import net.rim.device.api.system.Bitmap;
import net.rim.device.api.ui.component.PasswordEditField;
import net.rim.device.api.xml.parsers.*;
import org.w3c.dom.*;

public class appsecundaryscreen extends MainScreen {
String title1= "my name is iniego montoya you ";
String title2 = "killed my father preper to die";
myListField field1;

public appsecundaryscreen (){
LabelField title = new LabelField ( "secondary screen " , LabelField.FIELD_TOP | LabelField.USE_ALL_WIDTH );
setTitle (title);

add( new RichTextField("foo"));
field1 = new myListField();
mymenuitem item1 = new mymenuitem( "Call vm",3,2 );

mymenuitem item2 = new mymenuitem ( "help",2,1);

field1.insert(1,"best application ever!!!");
// field1.layout(20,30);

class myListField extends ObjectListField {

protected boolean navigationClick(int status, int time)
Dialog.alert("my name is iniego montoya you killed my father preper to die!");
return true;

public void drawListRow(ListField listField, Graphics graphics, int index, int y, int width)
String line1Msg;// = (String)field1.get(field1, index);
line1Msg = "";
// int width = field1. getpreferredWidth(field1);
int h = listField.getRowHeight();
graphics.drawRect(0,y,width - 1 ,h);
graphics.drawText("bla bla",3,y);

/* drawRect(int x,
int y,
int width,
int height)
Old 09-07-2010, 08:46 PM   #2 (permalink)
BlackBerry Extraordinaire
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
Carrier: T-Mobile
Posts: 1,644
Post Thanks: 0
Thanked 34 Times in 33 Posts

Did you import the MyListField class after you moved it to another file?
Old 09-14-2010, 09:27 AM   #3 (permalink)
New Member
RockoAndy's Avatar
Join Date: Sep 2010
Model: 8900
Carrier: Airtel
Posts: 11
Post Thanks: 0
Thanked 0 Times in 0 Posts

hey did u make the class public.
r the 2 classes in the same package.
the amazing world of
Closed Thread

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Copyright 2004-2014
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.