Hi i am trying to inflate or change menu from child fragment , but not able to do so. The flow is like this .
If I try to inflate menu from activity (Main)--- work fine. if i try to infalte menu from fragment (SecondFrag)----work fine if i try to inflate menu from child fragment of(SecondFrag)----do not work
Sample Code is like this
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setHasOptionsMenu(true);
Log.d("It has option mener of not", ""+hasOptionsMenu());
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
//super.onCreateOptionsMenu(menu, inflater);
Log.d("Option Menu", "Activity Option Menu");
mActivity.getSupportMenuInflater().inflate(R.menu.deal_detaisl, menu);
Log.d("Option Menu", "Activity Option Menu");
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.deal_loc:
mActivity.showMapFragment();
break;
case R.id.deal_loc_route:
mActivity.showMapRoute();
break;
}
return false;
}