Code example for Fragment

Methods: onSaveInstanceState

0
     * @see 
     * android.support.v4.app.Fragment#onSaveInstanceState(android.os.Bundle) 
     */ 
    @Override 
    public void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        if (outState != null) {
            outState.putInt(KEY_RESOURCE_ID, mLayoutResourceId);
        } 
    } 
 
}