Problem of Timer and TimerTask for counter display all seconds on the screen.

Dear friends,

I have little problem in the use of the timer. I took the timer to display the counter on each period fix repeatedly. but I did not here. Please help me. The code is as shown below.

import java.util.Timer.

java.util.TimerTask to import;

Import net.rim.device.api.ui.Field;

Import net.rim.device.api.ui.UiApplication;

Import net.rim.device.api.ui.component.RichTextField;

Import net.rim.device.api.ui.container.MainScreen;

SerializableAttribute public class TimerTest extends UiApplication

{

Timer;

public static int COUNT = 0;

Public Shared Sub main (String [] args) {}

TimerTest tt = new TimerTest();

tt.enterEventDispatcher ();

}

public TimerTest()

{

a new screen

pushScreen (new TimerMainScreen());

}

SerializableAttribute public class TimerMainScreen extends screen

{

TimerMainScreen()

{

Add (new RichTextField ("Count =" + Integer.toString (COUNT), Field.NON_FOCUSABLE));

try {}

Timer = new Timer();

timer.scheduleAtFixedRate (new TimerMainEvent (), 200, 1000);

}

catch (System.Exception e)

{

do nothing

}

}

private class TimerMainEvent extends TimerTask

{

public void run()

{

Try

{

COUNT ++;

If (COUNTY<>

Add (new RichTextField ("Count =" + Integer.toString (COUNT), Field.NON_FOCUSABLE));

on the other

Timer.Cancel ();

Timer.Cancel ();

}

catch (System.Exception e)

{

Do nothing

}

}

}

}

}

Please let me know where I'm wrong, I want to display all seconds on the screen. If I set the interval 0 then it run TimerMainScreen first time but after all no update, I see on the screen.

I thank in advance

Vimal

Use the following Code in your race.

 UiApplication.getUiApplication().invokeLater(new Runnable()
 {
  public void run()
  {
   add(new RichTextField("Count = " + Integer.toString(COUNT)   ,Field.NON_FOCUSABLE));
  }
 });

Tags: BlackBerry Developers

Similar Questions

  • OPS matester detail page: how to have a "Display all" feature on the screen, so that all the master records and details are developed.


    Hello

    I was trying to get a function "SHOW ALL" on the master - detail page

    the detail table is a table of advancec.

    Please help me with entries on how to make the feature "SHOW ALL",

    Currently, you must click on ': show ' for each record to the master level to display the data of the child.

    Trying to reach 'Show all' then featured on click this key records on the page "expands" showiing master records with respective detail records.

    Concerning

    bhuvanm

    Hello

    You should not set DetailFlag = 'Y' in the whereclause, because there is no such record.

    Also detail flag are transitional attribute and not the query column, hence the error "invalid identification Code.

    I asked you to use DetailFlag as a column of query with the static value 'Y '.

    for example:

    SELECT 'Y' detail_flag

    Of

    This will display all the records in the table in expanded format. If you want conditionally then use decoding on some binding settings.

    For example:

    SELECT DECODE (: 1, "SHOWALL", "Y", "N") detail_flag

    Of

    This connection parameter must be passed each time you want to run the query for the table.

    Kind regards

    Sandeep M.

  • Hi my mac pro book do beep 1 times or 3 times and after that I get this report also the screen is empty

    Anonymous UUID: A3EA911B-155A-516D-C842-F126A85CE472

    Sat Jun 11 02:50:14 2016

    Panic report *.

    panic (cpu 0 0xffffff8016dce5fa appellant): Kernel trap at 0xfffff38016dc7d4a, type 14 = page fault, registers:

    CR0: 0X000000008001003B, CR2: 0XFFFFF38016DC7D4A CR3: 0X000000000F852000 CR4: 0 X 0000000000002660

    RAX: 0XFFFFFF8052295000, RBX: 0XFFFFFF801E3B8E00 RCX: 0XFFFFF38016DC7D4A RDX: 0 X 0000000000000000

    RER: 0XFFFFFF80777FBFB8, PBR: 0 X 0000000000000000, IHR: 0 X 0000000000000000, RDI: 0 X 0000000000000000

    R8: 0X00000000009743B4, R9: 0XFFFFFF8022E19D58, R10: 0 X 0000000000000000, R11: 0X0000000CF94BE149

    R12: 0XFFFFFF801E3B8DB0, R13: 0XFFFFFF80174EFBC8, R14: 0XFFFFFF80202AA240 R15: 0X0000000CF94BD629

    RFL: 0 X 0000000000010246, RIP: 0XFFFFF38016DC7D4A, CS: 0000000000000008, SS 0 X: 0 X 0000000000000010

    Lack of CR2: 0xfffff38016dc7d4a, error code: 0 x 0000000000000010, CPU error: 0x0, PL: 0

    Backtrace (CPU 0), frame: return address

    0xffffff80777fbc40: 0xffffff8016cdab12

    0xffffff80777fbcc0: 0xffffff8016dce5fa

    0xffffff80777fbea0: 0xffffff8016dec463

    0xffffff80777fbec0: 0xfffff38016dc7d4a

    The process corresponding to the current thread BSD name: UserEventAgent

    Mac OS version:

    15F34

    Kernel version:

    15.5.0 Darwin kernel version: kills Apr 19 18:36:36 PDT 2016; root:XNU-3248.50.21~8/RELEASE_X86_64

    Kernel UUID: 7E7B0822-D2DE-3B39-A7A5-77B40A668BC6

    Slide kernel: 0x0000000016a00000

    Text of core base: 0xffffff8016c00000

    Text __HIB base: 0xffffff8016b00000

    Name of system model: MacBookPro7, 1 (Mac-F222BEC8)

    Availability of the system in nanoseconds: 55722227259

    last load kext to 8290962436: com.apple.driver.AudioAUUC 1.70 (addr 0xffffff7f98e93000 size 32768)

    kexts responsible:

    com.apple.driver.AudioAUUC 1.70

    com.apple.driver.AppleHWSensor 1.9.5d0

    com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport 4.4.5f3

    com.apple.iokit.IOBluetoothUSBDFU 4.4.5f3

    com.apple.driver.AppleTyMCEDriver 1.0.2d2

    com.apple.driver.AGPM 110.22.0

    com Apple.filesystems.autofs 3.0

    com.apple.driver.AppleOSXWatchdog 1

    com.apple.driver.AppleMikeyHIDDriver 124

    com.apple.driver.AppleHDAHardwareConfigDriver 274,9

    com.apple.driver.AppleMikeyDriver 274,9

    com.apple.driver.AppleHDA 274,9

    com Apple.Driver.pmtelemetry 1

    com.apple.iokit.IOUserEthernet 1.0.1

    com.apple.iokit.IOBluetoothSerialManager 4.4.5f3

    3.12.8 com.apple.driver.AppleMuxControl

    com.apple.Dont_Steal_Mac_OS_X 7.0.0

    com.apple.driver.AppleUpstreamUserClient 3.6.1

    com.apple.driver.AppleBacklight 170.8.9

    com.apple.driver.AppleHV 1

    com.apple.driver.AppleIntelSlowAdaptiveClocking 4.0.0

    com.apple.GeForceTesla 10.0.0

    com.apple.driver.AppleFIVRDriver 4.1.0

    com.apple.driver.AppleMCCSControl 1.2.13

    com.apple.driver.AppleSMCLMU 208

    com.apple.driver.ACPI_SMC_PlatformPlugin 1.0.0

    com.apple.driver.AppleLPC 3.1

    com.apple.nvidia.NVDAStartup 10.1.0

    com.apple.driver.SMCMotionSensor 3.0.4d1

    com.apple.driver.AppleUSBTCButtons 245,4

    com.apple.driver.AppleUSBTCKeyEventDriver 245,4

    com.apple.driver.AppleUSBTCKeyboard 245,4

    com.apple.driver.AppleIRController 327,6

    com.apple.driver.AppleFileSystemDriver 3.0.1

    com.apple.AppleFSCompression.AppleFSCompressionTypeDataless 1.0.0d1

    com.apple.AppleFSCompression.AppleFSCompressionTypeZlib 1.0.0

    com.apple.BootCache 38

    com.apple.driver.AppleUSBStorageCoexistentDriver 3.7.1

    com.apple.driver.AppleUSBCardReader 3.7.1

    com.apple.iokit.SCSITaskUserClient 3.7.7

    2.8.5 com.apple.iokit.IOAHCIBlockStorage

    com.apple.iokit.AppleBCM5701Ethernet 10.2.0

    com.apple.driver.AirPort.Brcm4331 800.20.24

    com.apple.driver.AppleFWOHCI 5.5.4

    com.apple.driver.usb.AppleUSBOHCIPCI 1.0.1

    com.apple.driver.AppleAHCIPort 3.1.8

    com.apple.driver.usb.AppleUSBEHCIPCI 1.0.1

    com.apple.driver.AppleSmartBatteryManager 161.0.0

    com.apple.driver.AppleRTC 2.0

    com.apple.driver.AppleHPET 1.8

    com.apple.driver.AppleACPIButtons 4.0

    com.apple.driver.AppleSMBIOS 2.1

    com.apple.driver.AppleACPIEC 4.0

    com.apple.driver.AppleAPIC 1.7

    com.apple.driver.AppleIntelCPUPowerManagementClient 218.0.0

    com Apple.NKE.applicationfirewall 163

    com Apple.Security.Quarantine 3

    com.apple.security.TMSafetyNet 8

    com.apple.driver.AppleIntelCPUPowerManagement 218.0.0

    com.apple.iokit.IOBluetoothHostControllerUSBTransport 4.4.5f3

    3.12.8 com.apple.AppleGraphicsDeviceControl

    com Apple.kext.Triggers 1.0

    com.apple.driver.DspFuncLib 274,9

    com.apple.kext.OSvKernDSPLib 525

    com.apple.iokit.IOSurface 108.2.1

    com.apple.iokit.IOSerialFamily 11

    com.apple.iokit.IOBluetoothFamily 4.4.5f3

    3.12.8 com.apple.driver.AppleGraphicsControl

    com.apple.driver.AppleHDAController 274,9

    com.apple.iokit.IOHDAFamily 274,9

    com.apple.iokit.IOAudioFamily 204.4

    com.apple.vecLib.kext 1.2.0

    com.apple.driver.AppleBacklightExpert 1.1.0

    com.apple.driver.CoreCaptureResponder 1

    com.apple.iokit.IOSlowAdaptiveClockingFamily 1.0.0

    com.apple.nvidia.classic.NVDANV50HalTesla 10.0.0

    com.apple.driver.AppleSMBusController 1.0.14d1

    com.apple.iokit.IOFireWireIP 2.2.6

    com.apple.driver.AppleSMBusPCI 1.0.14d1

    com.apple.driver.IOPlatformPluginLegacy 1.0.0

    com.apple.nvidia.classic.NVDAResmanTesla 10.0.0

    com.apple.driver.IOPlatformPluginFamily 6.0.0d7

    com.apple.iokit.IONDRVSupport 2.4.1

    com.apple.iokit.IOGraphicsFamily 2.4.1

    com.apple.driver.AppleSMC 3.1.9

    com.apple.driver.usb.AppleUSBHub 1.0.1

    com.apple.driver.AppleUSBMultitouch 250,5

    com.apple.iokit.IOUSBHIDDriver 900.4.1

    com.apple.iokit.IOUSBMassStorageClass 4.0.2

    com.apple.iokit.IOSCSIBlockCommandsDevice 3.7.7

    com.apple.iokit.IOUSBMassStorageDriver 1.0.0

    com Apple.Driver.USB.cdc 5.0.0

    com.Apple.Driver.USB.Networking 5.0.0

    com.apple.driver.usb.AppleUSBHostCompositeDevice 1.0.1

    com.apple.iokit.IOSCSIMultimediaCommandsDevice 3.7.7

    com.apple.iokit.IOBDStorageFamily 1.8

    com.apple.iokit.IODVDStorageFamily 1.8

    com.apple.iokit.IOCDStorageFamily 1.8

    com.apple.driver.AppleXsanScheme 3

    com.apple.iokit.IOAHCISerialATAPI 2.6.2

    com.apple.iokit.IOSCSIArchitectureModelFamily 3.7.7

    com.apple.iokit.IOEthernetAVBController 1.0.3b3

    com.apple.driver.mDNSOffloadUserClient 1.0.1b8

    com.apple.iokit.IO80211Family 1110.26

    com.apple.iokit.IONetworkingFamily 3.2

    com Apple.Driver.corecapture 1.0.4

    4.6.1 com.apple.iokit.IOFireWireFamily

    com.apple.driver.AppleMCP89RootPortPM 1.11

    com.apple.driver.usb.AppleUSBOHCI 1.0.1

    com.apple.iokit.IOAHCIFamily 2.8.1

    com.apple.driver.AppleUSBMergeNub 900.4.1

    com.apple.driver.usb.AppleUSBEHCI 1.0.1

    2.2.9 com.apple.driver.NVSMU

    com.apple.driver.AppleEFINVRAM 2.0

    com.apple.iokit.IOUSBFamily 900.4.1

    com.apple.iokit.IOUSBHostFamily 1.0.1

    com.apple.driver.AppleUSBHostMergeProperties 1.0.1

    com.apple.driver.AppleEFIRuntime 2.0

    com.apple.iokit.IOHIDFamily 2.0.0

    com.apple.iokit.IOSMBusFamily 1.1

    com Apple.Security.sandbox 300.0

    com.apple.kext.AppleMatch 1.0.0d1

    com.apple.driver.AppleKeyStore 2

    com.apple.driver.AppleMobileFileIntegrity 1.0.5

    com.apple.driver.AppleCredentialManager 1.0

    com.apple.driver.DiskImages 417,4

    com.apple.iokit.IOStorageFamily 2.1

    com.apple.iokit.IOReportFamily 31

    com.apple.driver.AppleFDEKeyStore 28.30

    com.apple.driver.AppleACPIPlatform 4.0

    com.apple.iokit.IOPCIFamily 2.9

    com.apple.iokit.IOACPIFamily 1.4

    com.apple.kec.Libm 1

    com Apple.KEC.pthread 1

    com Apple.KEC.corecrypto 1.0

    Model: MacBookPro7, 1, MBP71.0039.B0E of BootROM, 2 processors, Intel Core 2 Duo, 2.4 GHz, 4 GB, MSC 1.62f7

    Graphics card: NVIDIA GeForce 320 M, NVIDIA GeForce 320 M, PCI, 256 MB

    Memory module: DIMM0/0 BANK, 4 GB DDR3, 1067 MHz, 0 x 0198, 0x393955353432382D3034312E4130314C4620

    Airport: spairport_wireless_card_type_airport_extreme (0x14E4, 0x8D), Broadcom BCM43xx 1.0 (5.106.98.100.24)

    Bluetooth: Version 4.4.5f3 17904, 3 services, 27 aircraft, 1 incoming serial ports

    Network service: Wi - Fi, AirPort, en1

    Serial ATA Device: KINGSTON SV300S37A120G, GB 120,03

    Serial ATA Device: MATSHITADVD-R UJ-898

    USB device: USB 2.0 Bus

    USB device: ISight built-in

    USB device: USB 2.0 Bus

    USB Device: Card reader

    USB device: USB Bus

    USB device: Hub BRCM2046

    USB Device: USB Bluetooth host controller

    USB Device: IR receiver

    USB device: Apple keyboard / Trackpad

    USB device: USB Bus

    Crush Bus:

    There is a hardware problem. Bring your Mac to an Apple Store for a free evaluation.

    On Mac computer startup tones - Apple Support

  • HOW TO SET THE TIME AND DATE FOR MALAGA SPAIN 29130

    TIME AND DATE FOR MALAGA SPAIN

    Hi Colin,

    Thanks for posting your query in Microsoft Community.

    • Are you referring to a zip code when you say 29130?

    I would refer to the procedure described in the article below to set the date and time in Windows 7.

    Change the display of dates, times, currencies, and measures

    You can also view: set the clock

    Hope this information is useful. Please feel free to answer in the case where you are facing in the future other problems with Windows.

  • I've been upgraded to El Capitan and electricity went off and stopped the session.  I don't have time to continue for 12 hours.  It is the CV.  How can I cancel until I have more time?

    I've been upgraded to El Capitan and electricity went off and stopped the session.  I don't have time to continue for 12 hours.  It is the CV.  How can I cancel until I have more time?

    Hello nancy milano,.

    Thanks for this info and choosing the communities Support from Apple. I know how important is able to complete your update to El Capitan at a later date! The good news is that you can simply delete the "install Mac OS X" install app in the Applications folder on your Mac. Then you can open the Mac App Store when you're ready to update and restart the download from the tab updates or searching through the Mac App Store for El Capitan. This is a resource that explains the process of update more:

    Update of OS X El Capitan

    See you soon!

  • How to adjust the brightness and contrast for Compaq Presario all-in-One CQ1-1007 D desktop PC

    How to adjust the brightness and contrast for Compaq Presario all-in-One CQ1 - 1007 D desktop PC? THX.

    There were buttons No. brightness and contrast on the front of the monitor-no onscreen menu.

    On your desktop,.
    Right-click to select graphic properties->

    in display settings, click Advanced settings
    Here you go, you can do almost anything with the brightness

    Hope it helps

  • Since the upgrade to 8.0, when navigation between screens, my computer screen becomes black for 1 second before the screen is redrawn. This happens regularly and is a major nuisance. It simulates a power failure. It does not happen with IE.

    Since the upgrade to 8.0, when navigation between screens, my computer screen becomes black for 1 second before the screen is redrawn. This happens regularly and is a major nuisance. It simulates a power failure. It does not happen with IE.

    Here I answer to my problem: I upgraded my graphics card and the problem seems to have disappeared.

  • The hand left panel doen't show the usual "Control Panel Home" switch and my control panel display is stuck on the classic view.

    The same thing happened to me recently: the hand left panel doen't show the usual "Control Panel Home" switch and my control panel display is stuck on the classic view. Click on "Show common tasks in folder" but that doesn't change anything. Finally, I tried a restore without success point. No idea how to get back the link "control Panel Home"?

    Thank you very much for your support

    Alain Truchat

    Split from here:

    http://answers.Microsoft.com/en-us/Windows/Forum/windows_xp-desktop/left-hand-pane-on-Control-Panel-missing-XP-Home/6ca7e184-e2be-4709-b865-81e5c3702629#last

    Hi, Alan.

    Reset Control Panel-
     
    Press Windows key + R
     
    Type inetcpl.cpl regsvr32.exe/n/i
     
    Press ok

  • When windows update (KB968930) power Shell2.0 and WinRm20 for win Vista tries to install the thugs of the computer then restarts and crashes again and again

    • When windows update (KB968930) power Shell2.0 and WinRm20 for win Vista tries to install the thugs of the computer then restarts and crashes again and again

    Hello LisaQuaranto,

    I suggest that you configure the computer to start in minimum mode, download the update from the Download Center and try to install the update.

    To perform a clean boot on a computer that is running Windows Vista:

    a. Click Start, type msconfig in the search box and press ENTER.

    If you are prompted for an administrator password or a confirmation, type the password, or click on continue.

    b. on the general tab, click Selective startup.

    c. under Selective startup, clear the check box load startup items.

    d. click OK.

    e. When prompted, click on restart.

    f. after the computer starts, check if the problem is resolved.

    If your problem is resolved after the clean boot, and then follow the steps in the following article to narrow down the exact source:

    http://support.Microsoft.com/kb/929135

    In addition, refer to the section on how to restore your computer to a Normal startup mode by following the steps under "Reset the computer to start as usual", after performing the clean boot troubleshooting.

    You can download the update following the link below:

    http://support.Microsoft.com/kb/968930

    Thank you
    Irfan H, Engineer Support Microsoft Answers

  • Discovered that I can't attend Photoshop World Expo unless I have sign up for PSW and pay for classes. I have attended the past 2 years and have learned a lot about the mini classes at the Expo, so why I'm not welcome this year?

    Discovered that I can't attend Photoshop World Expo unless I have sign up for PSW and pay for classes. I have attended the past 2 years and have learned a lot about the mini classes at the Expo, so why I'm not welcome this year?

    Hi Thomas,

    I'm afraid that you ask in the wrong place. Photoshop World is organized by Kelby Media, and the web site is

    http://PhotoshopWorld.com/

    On this site, there are a few suggestions (e-mail and telephone) contact:

    I hope this helps!

    Mike

  • Get an error message that says: we have detected an incompatible driver.  To get a better reading performance and faster, update your display driver.  View the details of the driver: ATI technologies Inc. - AMD Radeon HD 7640 G 3.0.11774 Compadtibilty Pro

    When I start the first items 11, I get an error message that says: we have detected an incompatible driver.  To get a better reading performance and faster, update your display driver.  View the details of the driver: ATI technologies Inc. - AMD Radeon HD 7640 G 3.0.11774 compatibility profile context.  My computer crashes when I click OK.

    It should be in the same place. But do not set your Folder Options to show all files, or you won't see it!

  • I have the creative cloud (Photoshop and Lightroom) in my computer, but I had a problem of invoice, and because of that, I had to do, the association again change the registered credit card. But when I click to download shows error 82. How can I fix it

    I have the creative cloud (Photoshop and Lightroom) in my computer, but I had a problem of invoice, and because of that, I had to do, the association again change the registered credit card. But when I click to download shows error 82. How can I fix it?

    check your account and confirm your adobe, Adobe ID id

    log out and then back to your office to cc using the same adobe id allowing you to check your subscription is current, https://helpx.adobe.com/creative-cloud/help/sign-in-out-activate-apps.html

  • Whenever I try to open the App Store it will remain open for more than 30 seconds before the close. Or it just restarts as soon as a home screen scroll above him. I can't keep it open long enough to even download an application.

    Whenever I try to open the App Store it will remain open for more than 30 seconds before the close. Or it just restarts as soon as a home screen scroll above him. I can't keep it open long enough to even download an application.

    Hello monorayfromportland,

    If you are unable to connect to the iTunes Store on your Apple TV, take a look at the troubleshooting steps below:

    If you cannot connect to the iTunes Store

    If you cannot connect to the iTunes Store on your Apple TV (4th generation):

    1. Make sure that your date and time are correct. Go to settings > general > Date and time.
    2. Check if your Apple TV software is up-to-date. To check the updates, select settings > system > software updates > software update.
    3. Make sure you have an active network connection. Go to settings > network.
    4. Check to see if other devices, such as computers or tablets, can connect to Wi - Fi and access to the Internet.
    5. Reset the wireless router by turning and then again.

    Take care.

  • Everything on my screen has tripled in size how it back to the normal size, ps I tried the right hand winder on cone and it just reduces the font size not all things on the screen itself

    Everything on my screen has tripled in size how it back to the normal size, ps I tried the right hand winder on cone and it just reduces the font size not all things on the screen itself

    Your lowered obtained resolution. This can occur if you are running an older game that uses 800 x 600 for example.

    Control Panel > display > settings - change the resolution to correct for your monitor. MS - MVP - Elephant Boy computers - don't panic!

  • Subject: healthreport, about: preferences, about: newtab all give the same error message: the URL is invalid and cannot be loaded. All this since the last update

    Whenever I select all: preferences? entrypoint = menubar #sync, about: healthreport, about: preferences, about: newtab, I get the same error message: "the URL is invalid and impossible to load. All this since the last update tot 50.0 FF. I have tried refreshing Firefox, but to no avail. Help, please. Best regards, mauver

    Hi FredMcD,

    You are the hero of the day. Well, everything seems to work again with the exception of my best websites (which should open when I click on new-tab). But it's only a minor problem and I can easily restore that manually.

    Thanks for your help,

    Mauver

Maybe you are looking for