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

Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.

Posts: 777
Registered: ‎07-21-2012
My Device: 9810
My Carrier: 0

Problem in preparing list field


i am facing problem in preparing list .there is a problem of i need to make custum list field.


public final class MyScreen extends MainScreen
     * Creates a new MyScreen object
    protected Vector listMembers ;;

    public MyScreen()
        // Set the displayed title of the screen       
        listMembers= new Vector();
        ListField l=new ListField();
        CustomList c=new CustomList(listMembers);
        //c.setCallback( listMembers);
add(c); } }



package mypackage;

import java.util.Vector;

import net.rim.device.api.ui.Color;
import net.rim.device.api.ui.Font;
import net.rim.device.api.ui.Graphics;
import net.rim.device.api.ui.component.Dialog;
import net.rim.device.api.ui.component.ListField;
import net.rim.device.api.ui.component.ListFieldCallback;

public class CustomList extends ListField implements ListFieldCallback{
Vector _v;

public CustomList(Vector listMembers) {
// TODO Auto-generated constructor stub
_v= listMembers;

public void drawListRow(ListField listField, Graphics graphics, int index,
int y, int width) {
graphics.drawText((String) _v.elementAt(index), 0, y,50);

public Object get(ListField listField, int index) {
// TODO Auto-generated method stub
return _v.elementAt(index);

public int getPreferredWidth(ListField listField) {
// TODO Auto-generated method stub
return 200;

public int indexOfList(ListField listField, String prefix, int start) {
// TODO Auto-generated method stub
return -1;



Please help me to solve this issue

Posts: 17,026
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Problem in preparing list field

i would suggest that you take a look at the list field samples that are available (for example by searching in the search box)
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: 777
Registered: ‎07-21-2012
My Device: 9810
My Carrier: 0

Re: Problem in preparing list field

Thanks for applying..i got the solution./



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

Re: Problem in preparing list field

Great, can you mark this as solved then - see Help link near the top for instructions if needed.