Here\'s a simple android app I\'ve created to demonstrate my problem:
public class OptionMenuTest extends Activity {
@Override
protected void onCrea
@Gerardo Contijoch answer is misleading, except for one fact:
In your example both Activity and Fragment get destroyed upon rotation and created again.
That is why onCreateOptionsMenu() is called twice. This is correct and expected behaviour.
By setRetainInstance(true) you tell Android not to destroy the fragment. This may prove useful in case of UI-less fragment holding no Activity' context (useful for AsyncTasks coordination and some other service-like stuff).
In other cases fragment this potentially leads to memory leak, which you are to avoid.