Questions tagged [timer]

Timer is a component that has the functionality to trigger a user defined action at regular intervals as configured by the user.

Timer is a component that has the functionality to trigger a user defined action at regular intervals as configured by the user.

Some timers (such as Java Swing timer, WPF DispatcherTimer, WinForms Timer) are also capable of firing they events in GUI thread so there is no need to switch into this thread in order to update the components. Other timers do not have this capability and are more optimized to handle big number of scheduled events.

Depending on how does the scheduler behaves if the new even should be fired when the current event has not yet been fully processed, the timer may be coalescing or non coalescing. A coalescing timer reduces multiple pending events to a single event, reducing the number of events to handle. A non-coalescing timer fires pending overtime events in rapid succession with no delay between them, in order to catch up.

19566 questions
4
votes
1 answer

WPF Dispatcher timer tick freezes my application

I've got a little problem using WPF Dispatcher Timer. On each timer tick my application freezes for a moment (until timer tick method finishes). This is my code: private DispatcherTimer _Timer = new DispatcherTimer(); _Timer.Tick += new…
Nebojsa Veron
  • 1,545
  • 3
  • 19
  • 36
4
votes
4 answers

Dispatcher timer is firing twice :(

i have problems with this timer, my function in the Tick event are appearing twice.. i want it to appear only once.. public void timerStart() { DispatcherTimer updaterTimer = new DispatcherTimer(); …
Braudy
  • 181
  • 1
  • 11
4
votes
2 answers

Update a textview even while user is not using my app

I basically want to create a timer. I have a textview where I need to show a timer like "Updating your location in 2min 29 secs" and I want the timer to decreament For eg 2min 28secs followed by 2min 27 secs. And I want to update it even when the…
ik024
  • 3,566
  • 7
  • 38
  • 61
4
votes
2 answers

How to use a countdown timer to stop a game - iOS [SWIFT] -

My game is supposed to be stopped after 60s. But nothing happens with my timer code. var timer = NSTimer() var counter:Int = 60 var labelCounter:SKLabelNode = SKLabelNode() Here is the code in my GameScene class : func startTimer() { …
Haox
  • 608
  • 1
  • 7
  • 23
4
votes
3 answers

What will happen if the code can't finished on time

If I set a timer to execute a code every 3 seconds. If the code isn't finished in 3 seconds, what will happen? The computer will terminal the code or wait for the code finish or continue the timer, and execute the code with the unfinished code…
Tattat
  • 15,548
  • 33
  • 87
  • 138
4
votes
1 answer

Timer is trying to convert to String

Can someone please tell me why the Timer is trying to Convert an int into a String. Here is the error that keeps coming up. CurrentTimePrinter.java:48: error: incompatible types: int cannot be converted to String time = new…
Dustin
  • 185
  • 3
  • 12
4
votes
4 answers

NSTimer stops firing in Background after some time

Hey I am developing an app in which i have to make API call every 30 sec, so i created NSTimer for it. But when my app goes into background timer stops firing after 3-4 minutes. So it works only 3-4 minutes in background,but not after that. How can…
Vivek Shah
  • 430
  • 5
  • 22
4
votes
1 answer

SetTimer with unique id

I want to set a timer for a window, but I don't know if that window already has timers running. If it does I do not want to overwrite any of those, so I need to choose a timer id that is free. MSDN is not helpful in my case, they describe pretty…
DaedalusAlpha
  • 1,610
  • 4
  • 20
  • 33
4
votes
1 answer

Timer doesn't seem to tick ( until I minimize window )

This is the image of the design window: Here is the MainForm.Designer.cs file: namespace SamsCSharp24 { partial class ImeObrasca { // irrelavent code is omitted, only event subscriptions are left private void…
AlwaysLearningNewStuff
  • 2,939
  • 3
  • 31
  • 84
4
votes
5 answers

unable to decode stream java.io.FileNotFoundException /storage/emulated/0 open failed:ENOENT(No such file or directory

hello i'm trying to save pictures taken on my application, but when i try to access the memory to place the data, an error comes out unable to decode stream java.io.FileNotFoundException /storage/emulated/0 open failed:ENOENT(No such file or…
Andonirock
  • 53
  • 1
  • 2
  • 8
4
votes
3 answers

Android execute a function after 1 hour

I have an android application where I am storing user's data on database when he/she activates the app. My app requires the user to stop the application manually in order to remove its entry from the database and along with that other services…
ik024
  • 3,566
  • 7
  • 38
  • 61
4
votes
3 answers

Change textColor of textswitcher/viewswitcher based on int value?

I have a countdown timer starting at 60000 milliseconds and want to change the text color from Color.BLUE to Color.RED once the time is at and below 10000 milliseconds. I've tried the following without any success; attempted to setTextColor of…
cjayem13
  • 903
  • 10
  • 24
4
votes
1 answer

Android postDelay method's reliability

I am using android.os.Handler's “postDelayed” method to turn ON and OFF a relay. There are 2 runnable - one for sending ON command and another for sending OFF command. The relay needs to be kept on for fixed ms and turned OFF for fixed ms again. I…
random
  • 10,238
  • 8
  • 57
  • 101
4
votes
4 answers

What is the best way to break out of iteration after a specific time?

I am iterating over an Iterator, where hasNext() will never return false. However, after a specified time (let's say 20 seconds), I want to stop iterating. The problem is that the next() method of the Iterator is blocking, but even so, after a…
Jane Wayne
  • 8,205
  • 17
  • 75
  • 120
4
votes
2 answers

Show a running timer in a WPF window

I need to show a running timer on the window along with information of a test, such as ID, test name, status, start time, end time, etc. I really wish that I could have a timer control on the page that tells the user that how long the test has been…
KField
  • 151
  • 1
  • 4
  • 13