×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Sep 2009
    Posts
    25

    Timer to repeat doing something?

    I want to send my data to server every 5 seconds and use timer to do that. So where will i put timer, in the feature function i want or in run() (implement Runnable) ?
    Can you show me how to create a Timer to do that? Thanks.

  2. #2
    Nokia Developer Champion
    Join Date
    Apr 2007
    Posts
    2,708

    Re: Timer to repeat doing something?

    well the J2ME Timer actuallyis an implementation of a Thread...
    You should simply look for Timer and TimerTask for J2ME...
    This is a very basic example :
    http://www.jasonslater.co.uk/2008/04...-screen-timer/

  3. #3
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,073

    Re: Timer to repeat doing something?

    I want to send my data to server every 5 seconds and use timer to do that. So where will i put timer, in the feature function i want or in run() (implement Runnable) ?
    Can you show me how to create a Timer to do that? Thanks.
    In your run(), put a do while(boolean) loop to repeate the process of sending the data to server, till this boolean is true.
    To insert a time interval of 5sec, put this.sleep(5000) a try/catch block within the while loop, to sleep it for 5sec's before the next request to server.

    thanks,
    ~Amitabh

Similar Threads

  1. When can you set the screensaver's Refresh Timer Value?
    By azhrei in forum Symbian Tools & SDKs
    Replies: 6
    Last Post: 2008-08-23, 10:12
  2. [Announce] Timer Sample (code)
    By JOM in forum Python
    Replies: 5
    Last Post: 2008-06-15, 00:23
  3. Crash with multiple ao_timer
    By noreli in forum Python
    Replies: 2
    Last Post: 2007-11-01, 06:18
  4. inactivity timer, backlight, system dialogue windows.
    By davidmaxwaterman in forum Series 40 & S60 Platform Feedback Archive
    Replies: 0
    Last Post: 2007-05-24, 03:11
  5. Timer delay between playbacks???
    By lalitsharma in forum Symbian C++
    Replies: 3
    Last Post: 2005-09-09, 11:45

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •