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
3 answers

Delete timer from another activity

i have got a login form, and i use sheredpreferences to store the login, if the user doesnt press the remember me button, i save the username during 5 minutes, after that time the username is deleted. if after the login ,and let´s say 3 minutes have…
Hugo Silva
  • 23
  • 1
  • 10
-1
votes
1 answer

How to send data from timer task to android service

I am looking for a way to send data from my timer task to service. I have seen many other post related to handlers and all but I do not want to run in my main thread
user1810931
  • 638
  • 2
  • 11
  • 33
-1
votes
3 answers

How to find the difference between two times in Android / Java?

Possible Duplicate: Calculating the Difference Between Two Java Date Instances i have two date values in two textboxes in string datatypes in HH:MM:SS format.HOw can i find difference between them and get result in HH:MM:SS?please help me...as…
jims
  • 21
  • 1
  • 5
-1
votes
1 answer

Timer (Source not found)

I tried to create a timer and a timertask but I can't get it to work :( "Your post does not have much context to explain the code sections; please explain your scenario more clearly."? Error Timer.sched(TimerTask, long, long) line: not…
Daniel Hammer
  • 39
  • 1
  • 5
-2
votes
1 answer

Timertask period don't work at the time i set

Android studio Java TimerTask don't work at the time i set. I want it to run every 15 minutes in a service class even when application is closed too. I want it to run every 15 minutes in a service class even when application is closed too. but it…
Gökdeniz
  • 1
  • 1
  • 1
-2
votes
1 answer

incrementing an object in a 2d array

Good day, so I intend for my code to loop through my array and increment the row index of object by 1 position. I used timer task because I want the object to move forward after certain amount of time. This is the code I have tried. I have looked…
-2
votes
2 answers

TimerTask how to do cyclical database queries?

I have a REST sending 2 parameters to database and want to have a timertask who shoud ask database at regular intervals. And the problem is that TimerTask and his method run() doesnt accept any parameters so how to do this: for example : sending 2…
MajkelEight
  • 107
  • 1
  • 8
-2
votes
4 answers

Thread.stop() is deprecated. But how to use TimerTask instead?

I have started a thread on press of a toggle button. Now I want to stop that thread on pressing that toggle button again. But Thread.stop() API has been deprecated. So, I am getting UnsupportedOperationException. I don't know how to use TimerTask as…
-2
votes
1 answer

Java code should execute every 5 seconds for one minute

My requirement is my java code should execute for every 5 seconds until for one minute. My code should start running every 5 seconds after completion of 1 minute it should stop executing that means my code should execute 12 times and it should…
-2
votes
5 answers

How can I control a timer in android?

I want to make an application about mini game. Detail : In 2 seconds you must to answer a question if you don't answer or the answer is wrong -> Game Over . But if your answer is true the Timer will reset become 0 and countdown again with diffirent…
tran minh
  • 1
  • 4
-2
votes
3 answers

Access to the database every 1 hour C#

I have a problem, I'm trying to create a service to connect to an API that I have created. This service has to connect to a database in Mysql every hour, and see if there is a certain value. For example every time I'll see if the field x has the…
-3
votes
2 answers

Launching thousands of Timers in a Java/Linux application

I’ve been developing a Java based Enterprise application on Linux platform whose one of the functions is to generate/store a record whenever there’s a request (https) and delete the record after an expiration period. This application may have to…
Sathish Rao
  • 75
  • 11
-3
votes
1 answer

How do i give a timer to my java program

I want to give a time to specific code. Means like a game. It is something like "Give answer in 20 seconds, otherwise game will be over". More specifically i just want to give time to user to give the input. I've searched a lot, tried a lot like…
-3
votes
1 answer

Perform a task periodically if some action does not happen within the period

I have this program to generate a random verification code. What I want to do is this. After a code is generated, if that code is not entered in a TextField and submitted within one minute, a new code should be generated. How can I achieve this in…
Chavi
  • 9
  • 5
-4
votes
2 answers

In Android, how to use a timer such that once the time is up, the application will say "time over"?

So, in my application, it's like , A task is to performed within a given time interval If the task is performed within the timer's time limit , then i want to add say t seconds to the timer Then again i want to perform step 2. If the task is not…
1 2 3
61
62