I have an app with two fragments, every fragment has a listview. When selecting elements from the list the context menu appears automatically, I handle events an so on … so far so good, but my problem is when I change to the other fragment, the context menu keeps visible so user may get confused thinking that it is the context menu from the current visible list view.
I’ve tried calling
getActivity().closeContextMenu();
when switching between fragments but it doesn’t work.
Any suggestion will be really appreciated.
Thank you!
I’ve found a solution:
I am using ListView.CHOICE_MODE_MULTIPLE_MODAL for multiple selection, at the MultiChoiceModeListener I save the actionmode for later use:
Then when I detect that user wants to change to another tab-frame I call