Created
June 8, 2016 05:05
-
-
Save mindwing/7a312ff0287c79945eb5f25bf9d277be to your computer and use it in GitHub Desktop.
Agera Explained - 02.Observables and updatables
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 MyUpdatableActivity extends Activity implements Updatable { | |
private Observable observable; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
observable = new MyObservable(); | |
} | |
@Override | |
public void update() { | |
// Act on the event | |
} | |
@Override | |
protected void onResume() { | |
super.onResume(); | |
observable.addUpdatable(this); | |
update(); | |
} | |
@Override | |
protected void onPause() { | |
super.onPause(); | |
observable.removeUpdatable(this); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment