Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Timing is Everything

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers.

Timing is Everything

Avatar for katfishi

katfishi

March 18, 2016

More Decks by katfishi

Other Decks in Programming

Transcript

  1. Timer timer = new Timer(); TimerTask task = new TimerTask()

    { @Override public void run() { // task here } }
  2. Handler handler = new Handler(); Runnable r = new Runnable()

    { @Override public void run() { // task here } }
  3. Runnable r = new Runnable() { @Override public void run()

    { // task here handler.postDelayed(this, TIME_DELAY); } }
  4. public static class AlarmReceiver extends BroadcastReceiver { @Override public void

    onReceive(Context context, Intent intent) { // task here } }
  5. Intent i = new Intent( MainActivity.this, AlarmReceiver.class); PendingIntent pi =

    PendingIntent .getBroadcast( MainActivity.this, REQUEST_CODE, i, FLAGS);