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

TextView widget error loading widget

My widget gives me "Problem loading widget" when trying to use it and I don't know why. Here's my code: Class public class DigitalClock extends AppWidgetProvider { public void onUpdate(Context context, final AppWidgetManager…
Timmo
  • 2,266
  • 4
  • 34
  • 54
0
votes
1 answer

How to play gif image for long time or continuosly

How to play gif image continuously on canvas. I am using surface view. When app getting loaded that gif image is running only once and then stops automatically. Any ideas to run gif continuously.
URAndroid
  • 6,177
  • 6
  • 30
  • 40
0
votes
0 answers

GWT timer throwing exception while in a standalone class

I am using GWTQuery to detect paste event on a textbox, then setting a small timer after which it is supposed to get the value pasted in it. Something like this: $("#paste").live("paste",new Function() { public boolean f(Event e)…
SexyBeast
  • 7,913
  • 28
  • 108
  • 196
0
votes
2 answers

Adjusting the TimerTask interval

I was trying to make an adjustable sequence of time by using scheduleatfixedrate. However, when I made this block of code I didn't know that one can't change the period after it has been executed unless the timer is purged. This is my attempt at a…
hacke
  • 279
  • 1
  • 6
  • 20
0
votes
2 answers

Handler runnable breaks application

I have timer which schedules each 1 sec, and as we can't toast in timertask I used handler.post(). But this code breaks my app: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); …
Kerim Amanov
  • 213
  • 3
  • 14
0
votes
0 answers

Handle UI thread using the Timer and Handler

I have problems on the handler and the timertask When I finished the handler to check the connection and update the UI on two separate threads, it works. But I want to update the network connection regularly. Maybe executing it per 5 second. I use…
user1494052
  • 47
  • 1
  • 7
0
votes
1 answer

java stop watch program - using System.nanoTime() and TimerTask together

I am writing a mini program in Java to use as a stop watch but I am not sure if I am using the right methods in terms of efficiency and accuracy. From what I have read on stackoverflow it it appears that System.nanoTime() is the best method to use…
Saad Attieh
  • 1,396
  • 3
  • 21
  • 42
0
votes
4 answers

Issue with TimerTask

Just have a look on this block of code: public Reminder() { a[0]=1000; a[1]=3000; a[2]=1000; a[3]=5000; timer = new Timer(); timer.schedule(new RemindTask(),0, a[i]); } ////////////////////// class RemindTask extends…
joey rohan
  • 3,505
  • 5
  • 33
  • 70
0
votes
1 answer

Timer in three EditTexts not working properly

I have made a Timer Application in android.In application there are three (uneditable)EditText and a Button.When i press Button first time the timer in 1st EditText will start ,when i press it 2nd time the timer in 1st EditText will stop and at the…
jimmy cool
  • 147
  • 3
  • 5
  • 14
0
votes
1 answer

How to remove timers from EJB container for Singleton beans on undeploy?

I have the following @Singleton bean that I am using to perform some scheduled tasks: @Singleton @Startup public class SqsScheduler { // Logger------------------------------------------------------------------- private static final Logger…
tarka
  • 5,289
  • 10
  • 51
  • 75
0
votes
2 answers

TimerTask generating error without excecuting

Im sorry about the title but I'm not sure hw else to describe the issue. I have a SingletonBean with a class that extends TimerTask. The point is that when the application is launched it starts running some a set of scheduled background tasks on a…
tarka
  • 5,289
  • 10
  • 51
  • 75
0
votes
2 answers

NullPointerException when using getInt(String)

I'm android beginner so please be easy on me. I'm doing some "exercises" and i'm writing simple app which will tell RSSI strength of home wifi network. Getting that number is pretty easy, but updating it and showing that on screen it's a little more…
rootpanthera
  • 2,731
  • 10
  • 33
  • 65
0
votes
4 answers

How to execute two task in timers separately?

Last time my problem is :"java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()". After that, I modify and used HandlerThread to call the location update function. There is no error but the location does…
0
votes
1 answer

How to make services execute multitask in a regular time and get data from other activity?

I like to make services execute two task in a regular time, is it possible? By the structure following, is it true? Actually I has tested it and it give me error...or I should embedded all task into a timer task?? Another question I like to ask is…
0
votes
1 answer

Android TimerTask only runs once, but sometimes a bit more often

my TimerTask in Android runs most of the time just once, sometimes it starts a bit more often and stops then. Basically I want an App to track the sensor-data of the device. I have a MainActivity and 2 Services for Sensoring and Logging. Here's the…
Philipp
  • 468
  • 3
  • 24