I think this problems extends beyond just ViewPager - it looks like a flaw
in how FragmentManager handles dispatching of Context Menu Item selection.
Here's the relevant code from FragmentManager.java (as of the current
ACLv4):
public boolean dispatchContextItemSelected(MenuItem item) {
if (mActive != null) {
for (int i=0; i<mAdded.size(); i++) {
Fragment f = mAdded.get(i);
if (f != null && !f.mHidden) {
if (f.onContextItemSelected(item)) {
return true;
}
}
}
}
return false;
}
Consider an activity with 2 ListFragments A and B, where selecting a row in
fragment A creates fragment B. Now, if you long-press a row in B it
correctly invokes the onCreateContextMenu method for B. However, when a
context menu item is selected, the code above executes and results in the
the onContextItemSelected callback for fragment A to be executed. I see
nothing in this code above correctly dispatching the selection only to
fragment B and not A.
This behavior is easily reproducible, FWIW.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en