BlackBerry Forums Support Community

Closed Thread
LinkBack Thread Tools
Old 08-19-2009, 07:56 AM   #1 (permalink)
New Member
newbie_bb's Avatar
Join Date: Aug 2009
Model: 8300
Carrier: simulator
Posts: 9
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default ListField content moving out of screen ..

Please Login to Remove!

I am very new to the blackberry development. I have a task and for that I am implementing fairly basic listfield with selection and on selection moving to other screen.
Problem:- The content i put in ListField are of quite good length as per the screen. Ex.Most Popular Articles - Search based on popularity and newness.

1) How i can wrap the content to fit the screen keeping it intact for scroll select.
2) How i can format the content (adding colors and size to content).

3)How i can add few more content below the main content, and that too with different format (color/size).

4) How i can implement the change.

Compiling my requirment will bring screen as follows.

Most Popular Articles - Search
based on popularity and

news | Reuters | 12 Auguts,2009


Please help me. I am stucked at this point. Please find the code i am using a follows

import java.util.Vector;

import net.rim.device.api.ui.Graphics;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.component.Dialog;
import net.rim.device.api.ui.component.ListField;
import net.rim.device.api.ui.component.ListFieldCallback;
import net.rim.device.api.ui.container.MainScreen;

public class LandingScreen extends MainScreen

ListField mainList = new ListField();
ListCallback mainCallback = new ListCallback();
public LandingScreen()
setTitle("Welcome To VCCircle");
String mostPopular = new String("Most Popular Articles - Search based on popularity and newness.");
String newlyAdded = new String("Newly Added - Search based on the newness.");
String allcategories = new String("All categories - All categories available to view in articles.");
mainCallback.insert(mostPopular, 0);
mainCallback.insert(newlyAdded, 1);
mainCallback.insert(allcategories, 2);
public boolean onClose()
return true;

public boolean trackwheelClick( int status, int time ) {
int selectedIndex = mainList.getSelectedIndex();
case 0:
//This shows how to push another screen
MostPopularScreen mostPopularScreen = new MostPopularScreen();
UiApplication.getUiApplication().pushScreen(mostPo pularScreen);
case 1:
NewlyAddedScreen newlyAddedScreen = new NewlyAddedScreen();
UiApplication.getUiApplication().pushScreen(newlyA ddedScreen);
case 2:
AllCategoryScreen allCategoryScreen = new AllCategoryScreen();
UiApplication.getUiApplication().pushScreen(allCat egoryScreen);
Dialog.alert("Unable to process request. Selection not available");
return true;
private static class ListCallback 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);
g.drawText(text, 0, y, 0, w);
public Object get(ListField list, int index)
return listElements.elementAt(index);
public int indexOfList(ListField list, String p, int s)
return listElements.indexOf(p, s);
public int getPreferredWidth(ListField list)
return Graphics.getScreenWidth();
public void insert(String toInsert, int index)
public void erase()

If you have any other idea or sample please let me know.

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

Windsor Commodore 20 Carpet Cleaner
Windsor Commodore 20 Carpet Cleaner pictureCommodore II Dental Oven Laboratory Furnace - for Parts/Repair
Commodore II Dental Oven Laboratory Furnace - for Parts/Repair pictureCommodore II Dental Oven Laboratory for Parts/Repair
Commodore II Dental Oven Laboratory for Parts/Repair picturePhoenix CPS 10 Commodore 64 C-64 Power Supply Untested 14084
Phoenix CPS 10 Commodore 64 C-64 Power Supply Untested 14084  pictureCommodore 2 VPF Dentist Furnace Working
Commodore 2 VPF Dentist Furnace Working picture

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