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

Service Stops at an unknown time in android?

I am a newbie in android. I am making an app in which some task has to be repeated after every specified time say 15 seconds. I am using a service for this. It works fine for sometime but my problem is it stops after any indefinite dont know whats…
user1508383
  • 95
  • 2
  • 11
0
votes
1 answer

restart timer fails

I would like to restart my timer when I receive a KeepAlive, the problem is that sometimes it doesn't restart, instead of that it creates a new one, so, finally the timer reaches the limit: public class KeepAliveTimer { long macAddress; Timer…
user1256477
  • 10,763
  • 7
  • 38
  • 62
0
votes
0 answers

App freezes with TimerTask with AsyncTask

I have scheduled a AsyncTask using a Timer by following code public void toCallAsynchronous() { TimerTask doAsynchronousTask; final Handler handler = new Handler(); Timer timer = new Timer(); doAsynchronousTask = new TimerTask()…
Ankuj
  • 713
  • 3
  • 10
  • 27
0
votes
0 answers

creating 2 timer

I have MyTimer which needs to parameters: public MyTimer(long mac, String ipAddress){ this.macAddress = mac; this.ip = ipAddress; timer = new Timer(); TimerTask timerTask = new TimerTask() { @Override public void…
user1256477
  • 10,763
  • 7
  • 38
  • 62
0
votes
5 answers

Java TimerTask should wait on a Blocking Queue

I have the following design: There is a Task which extends TimerTask and it is scheduled to run every minute. This Task will try to take items from a central queue (as a single consumer) and write their representation into a file. Additionally,…
Michael
  • 2,827
  • 4
  • 30
  • 47
0
votes
2 answers

Delay sending SMS using TimerTask

The code (android application) I am developing receives an SMS and if the SMS is from a certain number, then it returns a predefined SMS. This all works fine, though I want to add a Timer so that the reply seems realistic. Through a bit of research…
Kurt
  • 767
  • 8
  • 23
0
votes
1 answer

Calling run() method of TimerTask

For the problem I am solving, I have to run a series of calls at periodic intervals. To achieve this, I have implemented TimerTask. However, I also want to notify the timertask sometimes and need to call the same methods when certain conditions are…
vk239
  • 1,014
  • 1
  • 12
  • 30
0
votes
2 answers

Sampling Android Sensors

Is there a way to get the values from an Android sensor say every 5 minutes? For example, is there a way I can poll the AMBIENT_TEMPERATURE sensor every 5 minutes regardless of there being a change in temperature or not? Right now, I can only access…
corgichu
  • 2,580
  • 3
  • 32
  • 46
0
votes
2 answers

Android Start activity from timertask

Hi I have a timer task that check a file every 1 minute public class MyTimerTask extends TimerTask { //java.io.File file = new java.io.File("/mnt/sdcard/Bluetooth/1.txt"); java.io.File file = new java.io.File("init.rc"); public void CheckTheFile()…
El Sa7eR
  • 881
  • 3
  • 10
  • 17
0
votes
1 answer

qrtz schedulers running in all the clones of application server

Do we have any support from quartz_scheduler or spring framework for running a scheduled job in all the clones (instances) of the application server? In my Project, we are having 2 instances of Application server for load balancing. During server…
Libin
  • 125
  • 2
  • 15
0
votes
1 answer

Android Debugging ScheduledThreadPoolExecutor using DDMS

For my Android application, I use ScheduledThreadPoolExecutor instead of Timer because it is not affected by time changes. With the Timer, you can create it by giving it a name. EX: Timer myTimer = new Timer("TimerA"); This is very convenient…
user657178
  • 213
  • 1
  • 3
  • 7
0
votes
1 answer

Spring inject bean into startup class during server start up

My bean is : @Component public class KidsServerStartUp implements ServletContextListener { UploadService uplService; @Autowired public void setUplService( UploadService uplService ) { this.uplService = uplService; } …
Deepak Singhal
  • 10,568
  • 11
  • 59
  • 98
0
votes
2 answers

With each successive call to this `timerMethod` , timerInt's value increases faster than before

I am working on an app, which gets a sort of restart with an event. On the first run, the timer works perfect (1sec = 1 increment). but, on next run (1sec = 2 increment) on third run (1sec = 4 increment) and so on... I think there is something…
jeet.chanchawat
  • 5,842
  • 5
  • 38
  • 59
0
votes
1 answer

Starting AsyncTask in the onPostExecute

So here is how it is : I have an AsyncTask with a TimerTask. Every 15 seconds the AsyncTask is run. The AsyncTask gets XML data and put those in dynamically created TextView contained in dynamically create TableRow. onPostExecute i create all my…
Ben Lefebvre
  • 359
  • 5
  • 21
0
votes
0 answers

Android Service Multiple Services opened

I'm doing a project where I have to do a sync every 10 sec, I take on the server what people want to sync. Save this preferences in a array and go around the array to see the user preferences (what they want to sync). If the id 1 is selected then do…
Marc Ortiz
  • 2,242
  • 5
  • 27
  • 46