How it should work - the onContextItemSelected should return false if it is not the correct one to be used. I found the answer here:
http://stackoverflow.com/questions/25096534/context-menu-in-fragment-uses-listview-from-a-different-fragment-registerforcon
This way all the unwanted methods will return false and the one you need will be invoked.
@Override
public boolean onContextItemSelected(MenuItem item) {
if (getUserVisibleHint()) {
//your code
}
}
return false;
}
No comments:
Post a Comment