Created
July 7, 2014 21:52
-
-
Save tophyr/4166db8e23bdf8c97a9a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Foo { | |
private Handler mHandler; | |
private Runnable mJob; | |
private BroadcastReceiver mBR1 = new BroadcastReceiver() { | |
public Object mUnreachable; | |
@Override | |
public void onReceive(Intent i) { | |
Object goesAway = new Object(); | |
Foo.this.mJob = new Runnable() { ... }; | |
Foo.this.mHandler.postDelayed(mJob, 1000); // run mJob in 1 second | |
} | |
} | |
private BroadcastReceiver mBR2 = new BroadcastReceiver() { | |
@Override | |
public void onReceive(Intent i) { | |
Foo.this.mHandler.remove(Foo.this.mJob); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment