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
PIN: N/A
Carrier: simulator
Posts: 9
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default ListField content moving out of screen ..

Please Login to Remove!

Hi,
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
newness.


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.");
mainList.setCallback(mainCallback);
mainList.insert(0);
mainCallback.insert(mostPopular, 0);
mainList.insert(1);
mainCallback.insert(newlyAdded, 1);
mainList.insert(2);
mainCallback.insert(allcategories, 2);
this.add(mainList);
}
public boolean onClose()
{
System.exit(0);
return true;
}

public boolean trackwheelClick( int status, int time ) {
int selectedIndex = mainList.getSelectedIndex();
switch(selectedIndex)
{
case 0:
//This shows how to push another screen
MostPopularScreen mostPopularScreen = new MostPopularScreen();
UiApplication.getUiApplication().pushScreen(mostPo pularScreen);
break;
case 1:
NewlyAddedScreen newlyAddedScreen = new NewlyAddedScreen();
UiApplication.getUiApplication().pushScreen(newlyA ddedScreen);
break;
case 2:
AllCategoryScreen allCategoryScreen = new AllCategoryScreen();
UiApplication.getUiApplication().pushScreen(allCat egoryScreen);
break;
default:
Dialog.alert("Unable to process request. Selection not available");
break;
};
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)
{
listElements.addElement(toInsert);
}
public void erase()
{
listElements.removeAllElements();
}
}
}

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

Thanks,
Regards,
Amber
Offline  
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

GT308V / AF109 ex-USSR Germanium HF PNP Transistor QTY=20
$6.95
GT308V / AF109 ex-USSR Germanium HF PNP Transistor QTY=20 picture10 PCS HGTG11N120CND 43A 1200V Anti-Parallel Hyperfast Diode TO-247 New
$25.87
10 PCS HGTG11N120CND 43A 1200V Anti-Parallel Hyperfast Diode TO-247 New picture1pairs Transistor MITSUBISHI TO-220 2SB528/2SD358 B528/D358
$6.8
1pairs Transistor MITSUBISHI TO-220 2SB528/2SD358 B528/D358 picture5PCS Transistor MITSUBISHI TO-92 2SC1735 C1735
$2.99
5PCS  Transistor MITSUBISHI TO-92 2SC1735 C1735 picture1PCS Transistor TOSHIBA TO-3P 2SC2792 C2792
$4.7
1PCS  Transistor TOSHIBA TO-3P 2SC2792 C2792 picture






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