On-screen display clock

Hello guys

What is the best way to display a digital clock on the title screen? I know that there is no api available, but it should how to display the current time on the screen.

Thank you very much

Nitin

On the screen, have a DateField created with DateField.TIME and DateField.READONLY.

In your method of application, implement RealTimeClockListener and clockUpdated().

In the clockUpdated, have something like this:

public void clockUpdated() {
  final Date now = new Date();
  UiApplication.getUiApplication().invokeLater(new Runnable() {
    public void run() {
      myDateField.setDate(now);
      invalidate();
    }
  });
}

It's just one of the ways to do this - I gives the general idea, you can improve on it, as desired, with the help of other fields, play with the format (take a look at the DateFormat constructor parameter of the DateField), etc.

If you need a better granularity of one minute, implement a TimerTask and plan at intervals you want rather than using RealTimeClockListener.

Tags: BlackBerry Developers

Similar Questions

Maybe you are looking for

  • Stop the loops with a button

    I have an infinite loop is and display of data. How can I end the loop with a button or a keypress?

  • I can't move a folder to another folder, because I said that I don't have permission to do.

    original title: authorization I can't move a folder to another folder, because I 'need to permission' to do.  How can I get permission... it's my computer, nobody else uses it.

  • BSoD * STOP 0X000000F4 after Windows Update in February

    Dell Inspiron 6000XP, SP3I DO NOT HAVE INSTALL DISKS - Dell installed at the company. @Feb 14, I ran the Windows updates pending on my system.I also bought a camcorder and used to download files on the internet (will explain later). Started having BS

  • Gel W520 and HDD Led always on

    Hi, I have a new i7-2820 W520, 8 GB Ram, NVidia 1000 M, SSD OCZ Vertex3. After some problems with AHCI and SSD controller now it works very well, with all the drivers installed properly, but sometimes (1 or 2 times a day) the system freezes and the h

  • XPS 8300 SATA Port multiply

    This motherboard supports a SATA Port multiplier? I would like to add an external box with more than 1 SATA drive.  If this is not the case, what is recommended? Thank you