Questions tagged [timertask]

Timertask is a Java API class. Logically it represents a task that can be scheduled for one-time or repeated execution by a Timer

A TimerTask implements Runnable, also has a method to cancel the scheduled task, if required. It is used with java.util.Timer (Swing timer fires action events).

A concurrent package contains several classes that are similar to TimerTask by concept but provide additional funcitonality.

917 questions
-1
votes
1 answer

Auto exception on time out in JAVA

I need to create a method such that if I enter in that method and to if takes me more then 30 seconds to process that method then it should throw an exception and I will immediately get out from that method and I can handle that exception in the…
Harshit Gupta
  • 719
  • 1
  • 9
  • 26
-1
votes
2 answers

Android - Delay method call

What is the best way to delay a method call without freezing the UI or running of the program? I want to display circles on the screen every 5 seconds but in those 5 seconds, other existing circles will be changing size so the drawcircle method has…
Sygnerical
  • 231
  • 1
  • 3
  • 12
-1
votes
1 answer

Why won't this timer task format to "mm:ss"?

I have a countdown timer that I have created (before you suggest the built in one, I have unsolved problems with that in the past). Clearly I'm just not formatting this correctly, but I just can't seem to get it to go "mm:ss" for my data. Instead I…
Kat
  • 2,460
  • 2
  • 36
  • 70
-1
votes
2 answers

How to save timer class start time?

I am implementing countup concept in my project..it contains 3 question buttons..if user clicks on first button count up is start. Whenever he presses the 2nd question.. count up should reset. If user returns to first button then count up should…
-1
votes
1 answer

Android: Scheduling applications for continued execution

I have gone through various discussion threads and tried multiple iterations to have my application scheduled to repeatedly run at fixed intervals. I have been successful too, but starting the thread to get understanding how things work. I had tried…
-1
votes
2 answers

How to wait until a timer stops

I need to wait the next line to be waiting until a timer finishes. public void animation(){ timer1.start(); labelStatus.Visibility=true; } I want the labelStatus to be visible after the timer1 finished. private void…
LIH
  • 933
  • 2
  • 10
  • 25
-1
votes
2 answers

Run a function only once and force to return value within specific time

I have a function say Foo()...My requirement to run some function for specific time and force it to return value within that given time.For eg if i run this function for 100 ms then no matter how many numbers are added in List listofnumbers whitin…
steve
  • 67
  • 10
-1
votes
1 answer

Signal in linux c?

void CheckTasks() { makeTimer("First Timer", &firstTimerID, 2, 2); //2ms makeTimer("Second Timer", &secondTimerID, 10, 10); //10ms makeTimer("Third Timer", &thirdTimerID, 100, 100); //100ms } int…
-1
votes
1 answer

Restart a timer once it is cancelled

I have invoked cancel() method of Timer class outside the run() method of TimerTask class. I want to know is it possible to restart this timer? On stop button I have invoked cancel() method :- private void…
-1
votes
2 answers

linux start time and stop timer is not working ?

#include #include #include #include #include #include #include #include #include #include #include #include…
-1
votes
2 answers

Android schedule fast task

I have a problem with events schedulation. I need to change text color every fixed time. Range of this is between 100ms and 300ms. I've tried to use Android Timer - TimerTask but after 10-15 Thread the rendering is delayed then I lost real time…
murdock
  • 49
  • 1
  • 3
-1
votes
1 answer

What is the best way to run a scheduled task on Android even during deep sleep?

I am working on my bachelor thesis and have encountered a problem. What I have: I've written an app that is supposed to measure sensor data from an external device. Therefore it should run over a long period of time. In my MainActivity the user…
kaolick
  • 4,817
  • 5
  • 42
  • 53
-1
votes
1 answer

Get current x and y co-ordinates of touch (if the user is touching) every 20 milliseconds - Timers, Schedulers?

I want to use a function where I can get the x and y co-ordinates of a user (if he/she is currently touching the screen) every 20 milliseconds or similar. I know there timers and schedulers in Android. But the question is how do I get X and y…
-1
votes
1 answer

intentService thread not getting stopped permanently

Even after googling for long, I couldn't find the solution to my problem. Problem is: In my application, I launch an intent which call the file implementing intentService on click of toggle button and runs it at regular interval since…
-1
votes
1 answer

TimerTask Crash in previewCallback

I am using a TimerTask() in previewCallback for an app. However, it stops to work. I am newbie for Android development and I have no idea what or where is the problem. I am trying to reactive the camera preview after 5 seconds. I tried same code…
ciyo
  • 725
  • 4
  • 16
  • 36