Code example for Fragment

Methods: onSaveInstanceState

0
	@Override 
	public void onSaveInstanceState(Bundle outState) {
		outState.putSerializable("constraint", constraint);
		outState.putInt("index", index);
		outState.putBoolean("dirty", dirty);
		super.onSaveInstanceState(outState);
	} 
 
	@Override 
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(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);
	} 
 
	@Override 
	public void onActivityCreated(Bundle savedInstanceState) {
Stop searching for code, let great code find you!  Add Codota to your java IDE