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
0
votes
1 answer

Starting and Stopping a Thread-JButton Alignment

I am trying to create a simple Timer with a Start Stop and Reset Button. I am new to using the Threads and ActionListeners. I have this working, and can get my timer to begin, and my button to change text from start to stop. But after that i am…
CJ Powell
  • 35
  • 1
  • 11
0
votes
2 answers

Android Inception (A thread within a thread)

I have one function which queries a network server with a few "ping pongs" back and forth, and have written a custom handler to handle the message communication between my main UI thread and the communication thread (I was using AsyncTask for this,…
Octoth0rpe
  • 2,267
  • 4
  • 19
  • 21
0
votes
1 answer

Blackberry App Development - App Stops Working After 16-18 Hours

I apologize profusely right at the start, because I know that answering this question is going to be like nailing jello to a wall. I'll give as many details as I can, but there aren't many to give. I'm developing a Blackberry app that uses GPS to…
JMax2012
  • 373
  • 2
  • 6
  • 24
0
votes
2 answers

Is there anything like timer and timertask in c++ just like java has?

I am not an experinced c++ programmer. So I just want to know how to implement timer and timertask just like java has in C++. I have tried timer_create example that is in man page of timer_create but It is not working as per my requirement. I want…
Yuvi
  • 1,344
  • 4
  • 24
  • 46
-1
votes
1 answer

"local variables referenced from an inner class must be final or effectively final" in MouseEvent

I am trying to get the integer input from a jtextfield and set it as the integer for a timer jlabel when the jbutton is clicked but I keep getting this error inside the MouseEvent method local variables referenced from an inner class must be final…
-1
votes
2 answers

How to update LocalDateTime variable while using TimerTask

I'm learning Java on my own and I'm stuck with the following problem. I scheduled my code to run for every 120 seconds and my issue here is that can't find the way to update LocalDateTime variable now outside of the run() method. I have a private…
Andino
  • 1
  • 2
-1
votes
1 answer

How to run Timer independently in Java?

I am trying to build multiple Timers and scheduled independent tasks for each of them. I have a constructor for holding a Timer and its variable. Then, I will call them one by one but I found that the variables, passed to the Timer constructor, are…
WILLIAM
  • 457
  • 5
  • 28
-1
votes
1 answer

how to set a task to run twice a day at specified times in Java

I have a java class that is a basic task that inherits from the TimerTask class. public abstract class BasicTask extends TimerTask { private boolean taskBusy; protected synchronized boolean startTask() { if (taskBusy) { …
-1
votes
1 answer

How to execute items in a list one by one at some interval in Java?

I have a List of Items. I want to run some operation for each item in the list one by one. The operation might take 5 minutes to complete. The ask is that for a particular item in the list the operation should start and complete then only the…
-1
votes
1 answer

Sychronized execution in java

I am looking for some Timer() that runs a process for a given time, then waits some time , then repeats ... The Timer.scheduleAtFixedRate() does not wait-Stop- for sometime.
user13964799
-1
votes
1 answer

How do I make a responsive timer?

private int seconds = 5; private SpeedMathGo speedMathGo; Timer timeRemaining = new Timer(); TimerTask task = new TimerTask() { public void run() { if (speedMathGo.turn == "X") { …
-1
votes
1 answer

So I am running an ESP32 and i currently have it set to implement 2 tasks. Core 0 is aborting due to the watch dog timer

Task1 running on core 0 Task2 running on core 1 The response from slave 1 data register 40007 failed! The response from slave 1 data register 40008 failed! The response from slave 1 data register 40020 failed! The response from slave 1 data register…
-1
votes
2 answers

How to create new instance of TimerTask for Resume Button? (ERROR: TimerTask is scheduled already)

Good morning! I'm trying to do a pause button for my game, but having problems with initializing the timer task again when I want to resume the game. I get the error "java.lang.IllegalStateException: TimerTask is scheduled already", which according…
Android999
  • 72
  • 7
-1
votes
1 answer

Set timer for executing task multiple times

I have a requirement, where I need to create a timer task which will execute the function after every 10 sec. There is reset Button, on click of that reset Button I want to reset my time from 10 sec to 30 sec. Now after 30 sec when it execute the…
Rahul
  • 1,667
  • 6
  • 21
  • 38
-1
votes
1 answer

Condition never returning true

I have an if statement which checks if three slots are finished. If it is, the timer should stop, but the code is not running for some reason. I have seen a post similar to this If-condition never executes despite correct condition, however their…
Pi Net
  • 69
  • 8