×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Super Contributor
    Join Date
    Apr 2007
    Posts
    2,708

    Timer/Stopwatch made out of Image

    Hi all,
    I'd like to make a timer and/or stopwatch, not one of those hypermodern, digital, lcd types but one of those oldy, mechanical crappy ones
    I have managed to find a nice Image to use as a background, now I'd like to use another Image representing the pointer (or needles). Im fortunate cause I only have to use 1 of those instead of two (minutes and seconds)...
    Now I have been looking in the api's and it seems like it's only possible to translate (or mirror) an image for 90 degrees at a time...
    So does this mean that I have to make like 90 images (one for every degree) and after that by utilizing the mirror and translation facilities of the api cover all 360 degrees ?
    If anyone has any ideas/tips or experience with it please let me know...
    Btw i am obviosly implementing this on a Canvas

  2. #2
    Super Contributor
    Join Date
    Oct 2007
    Location
    Deva, Romania
    Posts
    3,471

    Re: Timer/Stopwatch made out of Image

    Hi,

    I might have a tip for you. I tried making a digital stopwatch a few weeks ago using timers (TimerTask and Timer). However when I tested it on two emulators (S60 3rd FP1 and Series 40 5th FP1) and on an N95 I discovered that it was very imprecise. After 40 seconds it showed 30 seconds and then the gap became wider and wider. So my point is that you should test this before putting too much effort into the project. If this happens all the time and not just in my case, Java may not be the best programming language to make a stopwatch.

  3. #3
    Super Contributor
    Join Date
    Apr 2007
    Posts
    2,708

    Re: Timer/Stopwatch made out of Image

    hi,
    the timer I have at the moment works pretty well, up to 20 minutes have been tested...
    so the timing and stuff looks like it is going pretty wel... I am not using a timer (and timertask) though, simply because I read it will not execute at the specified intervals if something else has a higher "priority" for the os...
    at this point my only problem is showing such a pointer (needle) in the form of an Image

  4. #4
    Super Contributor
    Join Date
    Oct 2007
    Location
    Deva, Romania
    Posts
    3,471

    Re: Timer/Stopwatch made out of Image

    Can you please tell me what you used? I'd very much like to try it again

  5. #5
    Super Contributor
    Join Date
    Apr 2007
    Posts
    2,708

    Re: Timer/Stopwatch made out of Image

    wel its pretty simple actually,
    the canvas has a run method which is called the whole time (loop), so the first time I get the system time and every loop thereafter i get the system time again and subtract it from one another... u keep doing this and u know how much time has passed right ?

    but I just discovered a problem on the N95, after 1 minute it goes in "standby" so the screen doesnt get repaint... If I wake him out of the standby it does know how much time has passed but at that point it stops completely... I also had set it as a timer, so after 3 minutes it had to play a sound, but if it goes in standby it will just surpass those 3 minutes without playing any sound, seems like it gets blocked or pauzed someway ???

  6. #6
    Super Contributor
    Join Date
    Apr 2007
    Posts
    2,708

    Re: Timer/Stopwatch made out of Image

    btw,
    i've been trying with timer and timertask for couple of hours now and it works pretty good actually... also on a N95...

  7. #7
    Super Contributor
    Join Date
    Oct 2007
    Location
    Deva, Romania
    Posts
    3,471

    Re: Timer/Stopwatch made out of Image

    Interesting... I never managed to figure out how to make it accurate. I even tried changing the interval hoping that I could get a better result. Good that you got it to work. This should be more efficient that a loop.

  8. #8
    Super Contributor
    Join Date
    Apr 2007
    Posts
    2,708

    Re: Timer/Stopwatch made out of Image

    well,
    im only using the timer and timertask at the end to play the sound... So I start the timer and when it finishes it plays the sound, so no intervals inbetween... the actual drawing of the clock is still managed by my loop, and that also works pretty well :P
    So it's a combination of the two techniques i guess, well If one doesnt work as u'd like u might as well try to use both and only the parts u feel comfortable with :P guess thats the only way when working on a platform that exists for 6 years and its taking 4 years to set up the next one (MIDP 3)...

Similar Threads

  1. --- ???save image problem??? ---
    By ferenn in forum Mobile Java Media (Graphics & Sounds)
    Replies: 6
    Last Post: 2007-10-01, 14:33
  2. Opening a JPEG Image
    By ummarbhutta in forum Mobile Java Media (Graphics & Sounds)
    Replies: 8
    Last Post: 2007-02-15, 06:34
  3. how to cut some part of Image
    By mshouab in forum Mobile Java Media (Graphics & Sounds)
    Replies: 2
    Last Post: 2006-08-04, 09:05
  4. HELP: Mutable Image to Immutable Image?
    By rj_cybersilver in forum Mobile Java Media (Graphics & Sounds)
    Replies: 1
    Last Post: 2005-03-26, 09:58
  5. Nokia Image Converter
    By davidpurdie in forum General Development Questions
    Replies: 0
    Last Post: 2004-02-18, 15:31

Posting Permissions

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