I have statically created a fragment (via XML). I'm trying to store the last displayed value in a bundle and display it whenever the app is started next. However I am not able to get it to work. For some reason `savedInstanceState` is always null.

```
public class DistanceSetterFragment extends Fragment implements SharedPreferences.OnSharedPreferenceChangeListener { 
    Distance distance = new Distance();

    @Override
    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);

        if (savedInstanceState!=null )
        {
            Log.d(this.getClass().getName(),"onCreate savedInstanceState is NOT null");

        }
        else
        {
            Log.d(this.getClass().getName(),"onCreate savedInstanceState is null");
        }

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
    {
        Log.d(this.getClass().getName(),"Distance "+distance);

        if (savedInstanceState!=null )
        {
            Log.d(this.getClass().getName(),"onCreateView savedInstanceState is NOT null");

        }
        else
        {
            Log.d(this.getClass().getName(),"onCreateView savedInstanceState is null");
        }

        return inflater.inflate(R.layout.fragment_distancesetter, container, false);
    }

    @Override
    public void onSaveInstanceState(Bundle outState) 
    {
        super.onSaveInstanceState(outState);

        if (distance!=null) {
            Log.d(this.getClass().getName(),"Saving DISTANCE_BEAN "+distance);
            outState.putSerializable(Constants.DISTANCE_BEAN, distance);
        }
        else
        {
            Log.d(this.getClass().getName(),"Distance BEAN IS NULL");

        }

        outState.putString("", "");

    }
}

```

Below is the fragment XML declared in my main activity XML

```
<fragment
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:id="@+id/fragment_distancesetter"
    android:layout_below="@id/img_logo_main"
    android:name="com.webconfs.xyz.fragments.DistanceSetterFragment"
    android:layout_marginLeft="4dp"
    android:layout_marginRight="4dp"
    />

```

As you can see 
- I have NOT set setRetainInstance(true) in my Fragment class and 
- My fragment XML has an ID associated with it 
 `android:id="@+id/fragment_distancesetter`