{ /** * Called when a state transition event happens. * * @param source The source of the event * @param event The event */ void onStateChanged(LifecycleOwner source, Lifecycle.Event event); } GenericLifecycleObserver @hide @OnLifecycleEvent(Lifecycle.Event.ON_ANY)
public class SupportActivity extends Activity implements LifecycleOwner { … private LifecycleRegistry mLifecycleRegistry = new LifecycleRegistry(this);