Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Kindly use <strong>TimerTask</strong> or <strong>Handler</strong> for these type of work.. Much more easier for you.</p> <p>For TimerTask:- <a href="http://enos.itcollege.ee/~jpoial/docs/tutorial/essential/threads/timer.html" rel="nofollow">http://enos.itcollege.ee/~jpoial/docs/tutorial/essential/threads/timer.html</a></p> <p>Fro Handler :- <a href="http://examples.javacodegeeks.com/android/core/os/handler/android-handler-example/" rel="nofollow">http://examples.javacodegeeks.com/android/core/os/handler/android-handler-example/</a></p> <p>Above are just examples if you dont like try any other examples.</p> <hr> <p>Handler handle = new Handler();</p> <p>Runnable runnable = new Runnable() {</p> <pre><code> @Override public void run() { //what ever you want to do... } }; </code></pre> <p>//How to call in any method like (onCreate)</p> <p>handle .postDelayed(runnable , 100);</p> <p><em><strong></em>***</strong>*Timer Task public class JavaReminder { Timer timer;</p> <pre><code>public JavaReminder(int seconds) { timer = new Timer(); //At this line a new Thread will be created timer.schedule(new RemindTask(), seconds*1000); //delay in milliseconds } class RemindTask extends TimerTask { @Override public void run() { System.out.println("ReminderTask is completed by Java timer"); timer.cancel(); //Not necessary because we call System.exit //System.exit(0); //Stops the AWT thread (and everything else) } } public static void main(String args[]) { System.out.println("Java timer is about to start"); JavaReminder reminderBeep = new JavaReminder(5); System.out.println("Remindertask is scheduled with Java timer."); } </code></pre> <p>}</p> <p>Output Java timer is about to start Remindertask is scheduled with Java timer. ReminderTask is completed by Java timer //this will print after 5 seconds</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload