BlackBerry Forums Support Community

Closed Thread
LinkBack Thread Tools
Old 06-09-2011, 01:18 PM   #1 (permalink)
New Member
Join Date: Jun 2011
Model: 9800
Carrier: Rogers
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts
Question How to add fields on screen with a loop running

Please Login to Remove!

Hi there,

I'm new to BB development and trying to have some buttons on the screen and a loop as a countdown timer running togather. But my codes only add the buttons on the screen after the loop finishes. Which kinds of Screen and Timer Classes should I use. My codes are as below and in the attachment. Thanks.

public class gameScreen extends MainScreen {
boolean answered;
long startTime;
RadioButtonGroup rbGroup;
String[] set;
RadioButtonField[] radioButton;
ButtonField submitButton;
FieldChangeListener submitFCL;
public gameScreen() {
answered = false;
startTime = System.currentTimeMillis();
rbGroup = new RadioButtonGroup();
radioButton = new RadioButtonField[4];
for (int i = 0; i < 4; i++) {
radioButton[i] = new RadioButtonField(set[i], rbGroup, false);
submitButton = new ButtonField("Submit");
submitFCL = new FieldChangeListener() {
public void fieldChanged(Field field, int context) {
int valueOfRadioButton = rbGroup.getSelectedIndex();
Dialog.alert("Answer is right!");
else Dialog.alert("Answer is wrong!");
answered = true;
long leftTime = 3000-(System.currentTimeMillis() - startTime);
while ((leftTime >= 0) && !answered) {
leftTime = 3000-(System.currentTimeMillis() - startTime);
if (leftTime <= 0);
Dialog.inform("Time Out!");
Attached Files
File Type: txt game.txt (1.2 KB, 2 views)

Last edited by zpluo : 06-09-2011 at 02:22 PM. Reason: add attachment
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

Similar Threads for: How to add fields on screen with a loop running
Thread Thread Starter Forum Replies Last Post
Unite! Help Guide Sith_Apprentice BlackBerry Unite 17 12-25-2008 02:08 PM
BES Server 4.1 Sp1 to Sp2 upgrade problems plantagenet BES Admin Corner 5 09-05-2007 01:48 AM
Hands on review: Screen Patronus Screen Protector for the 8700c lgreenberg BBF Reviews 42 01-29-2007 08:49 PM
low level error 1209 on bes 3.6 mackynoon BES Admin Corner 0 07-19-2005 07:02 AM

Samsung TEPRI Card
Samsung TEPRI Card pictureSamsung DCS Refurb Kit
Samsung DCS Refurb Kit pictureSamsung iDCS Handsets
Samsung iDCS Handsets pictureSamsung iDCS 18 Button LCD
Samsung iDCS 18 Button LCD pictureSamsung 16DLI
Samsung 16DLI picture

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