public FlashlightTile(Host host) {
super(host);
mFlashlightController = host.getFlashlightController();
- mFlashlightController.addCallback(this);
}
@Override
protected void handleDestroy() {
super.handleDestroy();
- mFlashlightController.removeCallback(this);
}
@Override
@Override
public void setListening(boolean listening) {
+ if (listening) {
+ mFlashlightController.addCallback(this);
+ } else {
+ mFlashlightController.removeCallback(this);
+ }
}
@Override