×

Discussion Board

Results 1 to 3 of 3

Thread: Thread.Sleep

  1. #1
    Registered User
    Join Date
    Dec 2007
    Posts
    2

    Question Thread.Sleep

    Hi Guys,

    I don't know if this is the forum I'm supposed to be writing on ...but here goes.

    Did any of you find a solution on how to use the Thread.Sleep(ms) method so that ot behaves the same on every Nokia Device?
    For instance, I have a menu drawn on a Game Canvas and I set a delay when listening to keystrokes.
    On the Symbian phones the menu works perfectly but with the S40 phones I cannot select all the options because it calls the Keystroke handler more frequently. (E.g. - I'm on the first menuItem and press the Down Key, it takes me to the third of forth menuItem).

    Do you have any ideas (except building separate versions of the app. for every device?).


    Thank you very much!

    PS: Shouldn't the ms be a fixed time period for every device regardless of the OS? I don't really understand what causes that...

  2. #2
    Nokia Developer Champion
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,406

    Re: Thread.Sleep

    Hi ResHAcK,

    you shouldn't expect a millisec-precision when working with KVM.

    About your specific issue: are you using the Thread.sleep() method with a fixed amount of millisecs, or are you considering also the time taken by each loop of your application logic (so, subtracting it to the sleep time)?

    Another workaround to avoid your issue could be to manually check (with System.currentTimeMillis) if elapsed time is enough to perform the operation that present the mentioned problem.

    Hope it helps,
    Pit

  3. #3
    Registered User
    Join Date
    Dec 2007
    Posts
    2

    Thumbs up Re: Thread.Sleep

    Hi Pit,

    Thanks for your reply. I tried using Thread.Sleep(fixed_time) and there's a very big difference between the program running on a E50 vs 6300 phone.
    I will try the two techniques (subtraction and manually checking) and let you know the results.

    Which one did you find more effective?

    ResHAcK

Similar Threads

  1. Thread.sleep() equivalent
    By Larry101 in forum Symbian
    Replies: 12
    Last Post: 2009-06-22, 07:49
  2. Thread.sleep() and Images
    By earamsey in forum Mobile Java General
    Replies: 3
    Last Post: 2007-08-30, 20:19
  3. How to set current display before calling Thread.sleep()?
    By anummiah in forum Mobile Java General
    Replies: 1
    Last Post: 2006-06-21, 18:06
  4. speed comparison> callSerially and Thread.sleep
    By sinaptix in forum Mobile Java Media (Graphics & Sounds)
    Replies: 0
    Last Post: 2004-11-28, 15:17
  5. Problems with Thread.sleep()
    By tjessy in forum Mobile Java Media (Graphics & Sounds)
    Replies: 3
    Last Post: 2003-08-31, 23:06

Posting Permissions

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