Code example for Fragment

Methods: onSaveInstanceState

	public void onSaveInstanceState(Bundle outState) {
		outState.putSerializable("constraint", constraint);
		outState.putInt("index", index);
		outState.putBoolean("dirty", dirty);
	public void onCreate(Bundle savedInstanceState) {
		// If we get created for the first time we get our data from the intent 
		Bundle data = savedInstanceState != null ? savedInstanceState : getArguments();
		constraint = (Constraint) data.get("constraint");
		index = data.getInt("index");
		dirty = data.getBoolean("dirty", false);
	public void onActivityCreated(Bundle savedInstanceState) {
Contextual code suggestions in your IDE  Get Codota for Java