On Fri, Jan 20, 2012 at 12:11 PM, Nick Parker <npar...@zetetic.net> wrote:
> I am using setRetainInstance(true) with all of the Fragments.

OK, I'm perhaps barking up the wrong tree then.

> I am actually
> new'ing up the detail fragment on the invocation of the
> onContextItemSelected() so there is no old reference hanging around.

Yup, that tree's looking mighty sad.

> After
> looking a bit further, I am starting to wonder if it has something to do
> with the context menu.  I am able to perform a separate Fragment Transaction
> replace operation during screen rotations triggered from the onListItemClick
> without issue.  Following screen rotation, I logged the getActivity() call
> in onCreateContextMenu which is still valid, but the onContextItemSelected
> shows getActivity() returning null.  Any thoughts as to why that might be?

On which fragment is getActivity() returning null? The ListFragment(?)
on which you have the context menu, or the newly instantiated one? If
it's the newly-instantiated one, that's not especially surprising, as
it will not go through any of its lifecycle methods until the
FragmentTransaction gets commit()'d and processing begins on it
shortly thereafter.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android 4.0 Programming Books: http://commonsware.com/books

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to