rxgroups-android/src/main/java/com/airbnb/rxgroups/GroupLifecycleManager.java
public static GroupLifecycleManager onCreate(ObservableManager observableManager,
      @Nullable Bundle savedState, @Nullable Object target) {

    ObservableGroup group;
    if (savedState != null) {
      State state = savedState.getParcelable(KEY_STATE);

      Preconditions.checkState(state != null, "Must call onSaveInstanceState() first");

      // First check the instance ID before restoring state. If it's not the same instance,
      // then we have to create a new group since the previous one is already destroyed.
      // Android can sometimes reuse the same instance after saving state and we can't reliably
      // determine when that happens. This is a workaround for that behavior.
      if (state.managerId != observableManager.id()) {
        group = observableManager.newGroup();
      } else {
        group = observableManager.getGroup(state.groupId);
      }
    } else {
      group = observableManager.newGroup();
    }

    group.lock();

    GroupLifecycleManager manager = new GroupLifecycleManager(observableManager, group);

    if (target != null) {
      manager.initializeAutoTaggingAndResubscription(target);
    }

    return manager;
  }
public static GroupLifecycleManager onCreate(ObservableManager observableManager,
      @Nullable Bundle savedState, @Nullable Object target) {

    ObservableGroup group;
    if (savedState != null) {
      State state = savedState.getParcelable(KEY_STATE);

      Preconditions.checkState(state != null, "Must call onSaveInstanceState() first");

      // First check the instance ID before restoring state. If it's not the same instance,
      // then we have to create a new group since the previous one is already destroyed.
      // Android can sometimes reuse the same instance after saving state and we can't reliably
      // determine when that happens. This is a workaround for that behavior.
      if (state.managerId != observableManager.id()) {
        group = observableManager.newGroup();
      } else {
        group = observableManager.getGroup(state.groupId);
      }
    } else {
      group = observableManager.newGroup();
    }

    group.lock();

    GroupLifecycleManager manager = new GroupLifecycleManager(observableManager, group);

    if (target != null) {
      manager.initializeAutoTaggingAndResubscription(target);
    }

    return manager;
  }
public static GroupLifecycleManager onCreate ( ObservableManager observableManager , @ Nullable Bundle savedState , @ Nullable Object target ) { ObservableGroup group ; if ( savedState != null ) { State state = savedState . getParcelable ( KEY_STATE ) ; Preconditions . checkState ( state != null , "Must call onSaveInstanceState() first" ) ; // First check the instance ID before restoring state. If it's not the same instance, // then we have to create a new group since the previous one is already destroyed. // Android can sometimes reuse the same instance after saving state and we can't reliably // determine when that happens. This is a workaround for that behavior. if ( state . managerId != observableManager . id ( ) ) { group = observableManager . newGroup ( ) ; } else { group = observableManager . getGroup ( state . groupId ) ; } } else { group = observableManager . newGroup ( ) ; } group . lock ( ) ; GroupLifecycleManager manager = new GroupLifecycleManager ( observableManager , group ) ; if ( target != null ) { manager . initializeAutoTaggingAndResubscription ( target ) ; } return manager ; }
Call this method from your Activity or Fragment's onCreate method
Call this method from your Activity or Fragment s onCreate method