Obsolete
Status Update
Comments
gl...@gmail.com <gl...@gmail.com> #2
Please see this Stack Overflow question, comments, and answers for more detail about the apparent fragment documentation defects.
http://stackoverflow.com/q/12549521/403455
Description
As background, Fragments are apparently sometimes instantiated by the Android OS and thus [need a public no-arg constructor][1]:
But the [NewsReader demo][2] from the official Android training on Fragments constructs the `HeadlinesFragment` class and configures it with `setOnHeadlineSelectedListener(this)` from `NewsReaderActivity.onCreate()`.
If the Android OS re-instantiates this fragment, the `mHeadlineSelectedListener` field will be null because `HeadlinesFragment` doesn't save or restore its state.
Is this a bug or am I missing something?
[1]:
[2]: