Save the instance state of the adapter to keep expanded/collapsed states when rotating or
pausing the activity.
358361
@Override
    protected void onSaveInstanceState(@NonNull Bundle outState) {
        super.onSaveInstanceState(outState);
        mExpandableAdapter.onSaveInstanceState(outState);
        outState.putSerializable(SAVED_TEST_DATA_ITEM_LIST, mTestDataItemList);
    }
44073
void save() {

        saveAndDeleteEntities(false, new I_CmsSimpleCallback<Boolean>() {

            public void execute(Boolean hasChangedSettings) {

                setSaved();
                setUnchanged();
                m_hasChangedSettings = m_hasChangedSettings || hasChangedSettings.booleanValue();
            }
        });
    }
654828
public static void pause() {
        SiftImpl localInstance = instance;
        if (localInstance != null) {
            localInstance.save();
        }

        AppStateCollector localAppStateCollector = appStateCollector;
        if (localAppStateCollector != null) {
            localAppStateCollector.disconnectLocationServices();
        }
    }
295523
public static void onRestoreInstanceState(Object context, Bundle savedInstanceState) {
		
		if(ProfileService.getInstance(context).isActive(context, Profile.STATE) && savedInstanceState != null) {
			
			long millis = System.currentTimeMillis();
		
			StateService.newInstance(ContextUtils.discover(context)).restore(context, savedInstanceState);
			
			millis = System.currentTimeMillis() - millis;
				
			Log.i("INSTRUMENTATION:IckleStateProfile#onRestoreInstanceState", 
				  StateUtils.class.getClass().getSimpleName() + ": " + millis + "ms");
		}
	}
210297
@UiThread
    protected void collapseView() {
        setExpanded(false);
        onExpansionToggled(true);

        if (mParentViewHolderExpandCollapseListener != null) {
            mParentViewHolderExpandCollapseListener.onParentCollapsed(getAdapterPosition());
        }
    }
754527
public void restart() {
        int width = getWidth();
        int height = getHeight();

        if (width == 0 || height == 0) {
            return; // Can't call restart() when view area is zero.
        }

        updateViewport(width, height);
        updateDrawableBounds();

        startNewTransition();
    }
252469
def save_state(self):
        
        settings = QtCore.QSettings()
        settings.setValue(
            'inasafe/useDefaultTemplates',
            self.default_template_radio.isChecked())
        settings.setValue(
            'inasafe/lastTemplate',
            self.template_combo.itemData(self.template_combo.currentIndex()))
        settings.setValue(
            'inasafe/lastCustomTemplate', self.template_path.text())
483279
@Override
    protected Parcelable onSaveInstanceState() {
        Parcelable superState = super.onSaveInstanceState();
        Bundle instanceState = new Bundle();
        instanceState.putParcelable(SUPER_STATE_KEY, superState);
        instanceState.putString(PROFILE_ID_KEY, profileId);
        instanceState.putInt(PRESET_SIZE_KEY, presetSizeType);
        instanceState.putBoolean(IS_CROPPED_KEY, isCropped);
        instanceState.putParcelable(BITMAP_KEY, imageContents);
        instanceState.putInt(BITMAP_WIDTH_KEY, queryWidth);
        instanceState.putInt(BITMAP_HEIGHT_KEY, queryHeight);
        instanceState.putBoolean(PENDING_REFRESH_KEY, lastRequest != null);

        return instanceState;
    }
1031659
public Object saveState(FacesContext context) {
        if (context == null) {
            throw new NullPointerException();
        }
        if (!initialStateMarked()) {
            Object values[] = new Object[1];
            values[0] = validationGroups;
            return values;
        }
        return null;
    }
741311
@SuppressWarnings("unchecked")
    public void restoreState(FacesContext context, Object state) {

        if (context == null) {
            throw new NullPointerException();
        }

        if (state != null) {

            // Unchecked cast from Object to List<BehaviorListener>
            listeners = (List<BehaviorListener>)UIComponentBase.restoreAttachedState(context, state);

            // If we saved state last time, save state again next time.
            clearInitialState();
        }
    }
1081709
public void saveState() {
	  ByteArrayOutputStream bos = new ByteArrayOutputStream();
	  try {
		ObjectOutputStream oos = new ObjectOutputStream(bos);
		oos.writeObject(this);
		oos.flush();
		keyValStore.setValue(keyValStoreName, Hex.toHexString(bos.toByteArray()));
		bos.close();
	} catch (IOException e) {
		logger.debug(String.format("Could not save state of member %s", this.name), e);
	}
   }
639761
public Object saveState(FacesContext context) {
        if (context == null) {
            throw new NullPointerException();
        }
        Object values[] = new Object[1];
        values[0] = methodExpression;
        return (values);

    }
324523
public void saveAndStopActions() {
		for (Interruptible action : getInterruptibleActions()) {
			if (action.isInProgress()) {
				action.save();
				action.stop();
			}
		}
	}
255462
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_changelog);

        mAppbar = ButterKnife.findById(this, R.id.appbar);
        mContainer = ButterKnife.findById(this, R.id.container);

        configAppBar();
        parseExtras(savedInstanceState);
    }
1361543
@Override protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_youtube_sample);
    ButterKnife.inject(this);
    initializeYoutubeFragment();
    initializeDraggablePanel();
    hookDraggablePanelListeners();
  }
398894
public static <T> void saveInstanceState(@NonNull T target, @NonNull Bundle state) {
        IMPL.saveInstanceState(target, state);
    }
689800
public Bundle saveInstanceState(Bundle savedInstanceState) {
        if (savedInstanceState != null) {
            savedInstanceState.putBoolean(BUNDLE_CROSS_FADED, mCrossFadeSlidingPaneLayout.isOpen());
        }
        return savedInstanceState;
    }