I am developing a application that should support on both phone and tablet. In this application i am using fragments from android.
Now the flow of the application is like
MainActivity --> Fragment1 --> Fragment2
In this application , i want a menu item that should show only in Fragment2 along with activity's menu items.
So i have tried one solution like adding globle menu items in MainActivity and in Fragment2 replacing the whole MainActivity's menu with Fragment2 specific Menu.
setHasOptionsMenu(true);
inside onCreateView , and implement this method.
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.menu_f, menu);
super.onCreateOptionsMenu(menu,inflater);
}
Now its work exactly fine for phone layout , but when its come to tablet problem arise.
Here is my ScreenShots.
Fragment 1

Fragment 1 and Fragment 2 combination when pressing 9 in keybord(Tablet mode ).

And Finally when i pressed 9 again to come back to pHone view it shows me extra menu item.

I just marked a extra menu item in Image. So why this me coming and how can i resolve it ?
onConfigurationChangedand callinvalidateOptionsMenu()orsupportInvalidateOptionsMenu()which ever is appropiate - PantheronConfigurationChangednot getting called you have to setandroid:configChanges="orientation|screenSize"in the manifest file - Panther