It gives an compile error

Compiled from Timer.java (version 1.5 : 49.0, super bit)
public class java.util.Timer {

  // Method descriptor #8 (Ljava/lang/String;Z)V
  // Stack: 3, Locals: 3
  public Timer(java.lang.String name, boolean isDaemon);
     0  aload_0 [this]
     1  invokespecial java.lang.Object() [1]
     4  new java.lang.RuntimeException [2]
     7  dup
     8  ldc <String "Stub!"> [3]
    10  invokespecial java.lang.RuntimeException(java.lang.String) [4]
    13  athrow
      Line numbers:
        [pc: 0, line: 4]
      Local variable table:
        [pc: 0, pc: 14] local: this index: 0 type: java.util.Timer
        [pc: 0, pc: 14] local: name index: 1 type: java.lang.String
        [pc: 0, pc: 14] local: isDaemon index: 2 type: boolean

  // Method descriptor #18 (Ljava/lang/String;)V
  // Stack: 3, Locals: 2
  public Timer(java.lang.String name);
     0  aload_0 [this]
     1  invokespecial java.lang.Object() [1]
     4  new java.lang.RuntimeException [2]
     7  dup
     8  ldc <String "Stub!"> [3]
    10  invokespecial java.lang.RuntimeException(java.lang.String) [4]
    13  athrow
      Line numbers:
        [pc: 0, line: 5]
      Local variable table:
        [pc: 0, pc: 14] local: this index: 0 type: java.util.Timer
        [pc: 0, pc: 14] local: name index: 1 type: java.lang.String

  // Method descriptor #19 (Z)V
  // Stack: 3, Locals: 2
  public Timer(boolean isDaemon);
     0  aload_0 [this]
     1  invokespecial java.lang.Object() [1]
     4  new java.lang.RuntimeException [2]
     7  dup
     8  ldc <String "Stub!"> [3]
    10  invokespecial java.lang.RuntimeException(java.lang.String) [4]
    13  athrow
      Line numbers:
        [pc: 0, line: 6]
      Local variable table:
        [pc: 0, pc: 14] local: this index: 0 type: java.util.Timer
        [pc: 0, pc: 14] local: isDaemon index: 1 type: boolean

  // Method descriptor #20 ()V
  // Stack: 3, Locals: 1
  public Timer();
     0  aload_0 [this]
     1  invokespecial java.lang.Object() [1]
     4  new java.lang.RuntimeException [2]
     7  dup
     8  ldc <String "Stub!"> [3]
    10  invokespecial java.lang.RuntimeException(java.lang.String) [4]
    13  athrow
      Line numbers:
        [pc: 0, line: 7]
      Local variable table:
        [pc: 0, pc: 14] local: this index: 0 type: java.util.Timer

  // Method descriptor #20 ()V
  // Stack: 3, Locals: 1
  public void cancel();
     0  new java.lang.RuntimeException [2]
     3  dup
     4  ldc <String "Stub!"> [3]
     6  invokespecial java.lang.RuntimeException(java.lang.String) [4]
     9  athrow
      Line numbers:
        [pc: 0, line: 8]
      Local variable table:
        [pc: 0, pc: 10] local: this index: 0 type: java.util.Timer

  // Method descriptor #23 ()I
  // Stack: 3, Locals: 1
  public int purge();
     0  new java.lang.RuntimeException [2]
     3  dup
     4  ldc <String "Stub!"> [3]
     6  invokespecial java.lang.RuntimeException(java.lang.String) [4]
     9  athrow
      Line numbers:
        [pc: 0, line: 9]
      Local variable table:
        [pc: 0, pc: 10] local: this index: 0 type: java.util.Timer

  // Method descriptor #25 (Ljava/util/TimerTask;Ljava/util/Date;)V
  // Stack: 3, Locals: 3
  public void schedule(java.util.TimerTask task, java.util.Date when);
     0  new java.lang.RuntimeException [2]
     3  dup
     4  ldc <String "Stub!"> [3]
     6  invokespecial java.lang.RuntimeException(java.lang.String) [4]
     9  athrow
      Line numbers:
        [pc: 0, line: 10]
      Local variable table:
        [pc: 0, pc: 10] local: this index: 0 type: java.util.Timer
        [pc: 0, pc: 10] local: task index: 1 type: java.util.TimerTask
        [pc: 0, pc: 10] local: when index: 2 type: java.util.Date

  // Method descriptor #30 (Ljava/util/TimerTask;J)V
  // Stack: 3, Locals: 4
  public void schedule(java.util.TimerTask task, long delay);
     0  new java.lang.RuntimeException [2]
     3  dup
     4  ldc <String "Stub!"> [3]
     6  invokespecial java.lang.RuntimeException(java.lang.String) [4]
     9  athrow
      Line numbers:
        [pc: 0, line: 11]
      Local variable table:
        [pc: 0, pc: 10] local: this index: 0 type: java.util.Timer
        [pc: 0, pc: 10] local: task index: 1 type: java.util.TimerTask
        [pc: 0, pc: 10] local: delay index: 2 type: long

  // Method descriptor #33 (Ljava/util/TimerTask;JJ)V
  // Stack: 3, Locals: 6
  public void schedule(java.util.TimerTask task, long delay, long period);
     0  new java.lang.RuntimeException [2]
     3  dup
     4  ldc <String "Stub!"> [3]
     6  invokespecial java.lang.RuntimeException(java.lang.String) [4]
     9  athrow
      Line numbers:
        [pc: 0, line: 12]
      Local variable table:
        [pc: 0, pc: 10] local: this index: 0 type: java.util.Timer
        [pc: 0, pc: 10] local: task index: 1 type: java.util.TimerTask
        [pc: 0, pc: 10] local: delay index: 2 type: long
        [pc: 0, pc: 10] local: period index: 4 type: long

  // Method descriptor #35 (Ljava/util/TimerTask;Ljava/util/Date;J)V
  // Stack: 3, Locals: 5
  public void schedule(java.util.TimerTask task, java.util.Date when, long
period);
     0  new java.lang.RuntimeException [2]
     3  dup
     4  ldc <String "Stub!"> [3]
     6  invokespecial java.lang.RuntimeException(java.lang.String) [4]
     9  athrow
      Line numbers:
        [pc: 0, line: 13]
      Local variable table:
        [pc: 0, pc: 10] local: this index: 0 type: java.util.Timer
        [pc: 0, pc: 10] local: task index: 1 type: java.util.TimerTask
        [pc: 0, pc: 10] local: when index: 2 type: java.util.Date
        [pc: 0, pc: 10] local: period index: 3 type: long

  // Method descriptor #33 (Ljava/util/TimerTask;JJ)V
  // Stack: 3, Locals: 6
  public void scheduleAtFixedRate(java.util.TimerTask task, long delay,
long period);
     0  new java.lang.RuntimeException [2]
     3  dup
     4  ldc <String "Stub!"> [3]
     6  invokespecial java.lang.RuntimeException(java.lang.String) [4]
     9  athrow
      Line numbers:
        [pc: 0, line: 14]
      Local variable table:
        [pc: 0, pc: 10] local: this index: 0 type: java.util.Timer
        [pc: 0, pc: 10] local: task index: 1 type: java.util.TimerTask
        [pc: 0, pc: 10] local: delay index: 2 type: long
        [pc: 0, pc: 10] local: period index: 4 type: long

  // Method descriptor #35 (Ljava/util/TimerTask;Ljava/util/Date;J)V
  // Stack: 3, Locals: 5
  public void scheduleAtFixedRate(java.util.TimerTask task, java.util.Date
when, long period);
     0  new java.lang.RuntimeException [2]
     3  dup
     4  ldc <String "Stub!"> [3]
     6  invokespecial java.lang.RuntimeException(java.lang.String) [4]
     9  athrow
      Line numbers:
        [pc: 0, line: 15]
      Local variable table:
        [pc: 0, pc: 10] local: this index: 0 type: java.util.Timer
        [pc: 0, pc: 10] local: task index: 1 type: java.util.TimerTask
        [pc: 0, pc: 10] local: when index: 2 type: java.util.Date
        [pc: 0, pc: 10] local: period index: 3 type: long
}




On Thu, Jul 5, 2012 at 5:42 PM, arun kumar <[email protected]> wrote:

> import java.util.Date;
>
> import java.util.Timer;
>
> import java.util.TimerTask;
>
> public class ClassExecutingTask {
>
>     long delay = 10*1000; // delay in ms : 10 * 1000 ms = 10 sec.
>     LoopTask task = new LoopTask();
>     Timer timer = new Timer("TaskName");
>
>     public void start() {
>     timer.cancel();
>     timer = new Timer("TaskName");
>     Date executionDate = new Date(); // no params = now
>     timer.scheduleAtFixedRate(task, executionDate, delay);
>     }
>
>     private class LoopTask extends TimerTask {
>     public void run() {
>         System.out.println("This message will print every 10 seconds.");
>     }
>     }
>
>     public static void main(String[] args) {
>     ClassExecutingTask executingTask = new ClassExecutingTask();
>     executingTask.start();
>     }
>
>
> }
>
> On Thu, Jul 5, 2012 at 5:33 PM, Rahul Kaushik <[email protected]>wrote:
>
>> Hi,
>>
>> Can anyone pls tell me the best way to call an method after every 5 min
>> (handler,timer),i googled and found handler.postdeleyd doesnt not guarntee
>> to execute,timer hangs some time ,pls suggest me the way to call method
>> after every 5 minutes
>> Code snippet will be very useful
>>
>> Thanks
>>
>>  --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>
>
>
>
> --
> WITH REGARDS
> ARUN KUMAR P D
> +91-9994794759
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to