aspose file tools*
The moose likes Java Micro Edition and the fly likes J2ME Time Listner Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "J2ME Time Listner" Watch "J2ME Time Listner" New topic
Author

J2ME Time Listner

Ramkumar Subburaj
Ranch Hand

Joined: Sep 07, 2007
Posts: 83
Hello,

I am developing a World clock application and displaying times of 4 locations at a time.

I am using J2ME Polish for my UI

My problem is i want the change the time of the currently displaying locations when the system's time changes that is for every minute.

Please suggest me an efficient approach.

I tried on method which is mentioned below.

I extended the ClockItem in J2ME Polish item and override the paintmethod() such that when ever the time changes in the current display, all the others can be changed.

But the problem was it was happening for every second which i feel is not correct and i am unable to hide the seconds field.


SCJP 1.5, SCWCD 1.4.
Hanging between Web Services and EJB
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16142
    
  21

I'd call the system get time method on each of the intercepted paint calls. If the minutes digit has changed, repaint the other areas.


Customer surveys are for companies who didn't pay proper attention to begin with.
Ramkumar Subburaj
Ranch Hand

Joined: Sep 07, 2007
Posts: 83
Thanks for the reply but how to display the time with seconds hidden.

Can you please help me
Syam Sathyan George
Ranch Hand

Joined: Apr 26, 2006
Posts: 64
Hi,

I had a look at your method and seems ok
But to depend on UI component for time update can be an inaccurate approach.
J2ME polish is accurate with the painting based on thread timing and frame delay calculations.
But if the UI of the application increases then the delay of the UI updation might increase.
-----------------
So your time calculation shouldnt be depending on a UI element.
But it can be accurate if you use your own thread with a predetermined sleep time, wake up and check elapsed time, if its 1 min(as you might need) then update/do update/ else go sleep

--Syam Sathyan
(My Boss is a Jewish carpenter)


Syam.Sathyan.George
(My boss is a Jewish carpenter)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: J2ME Time Listner