1

How to stop onOptionsItemSelected being called from previous Fragment on click of action item?

view story
linux-howto

http://stackoverflow.com – I'm adding a fragment to my activity inside oncreate of it. And on click of a button I have to add same fragment (the new data will be loaded and displayed in fragment) to the activity. Also i'm calling setHasOptionsMenu(true) after data is loaded. The data displayed in fragment has to be shared on click of share icon on actionbar. Adding fragment in activity class: FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); ft.add(R.id.myFragContainerLayout, myFrag); ft.addToBackStack(null); ft.commit(); Options menu in fragment : @Override public voi (HowTos)