JakeWharton/ActionBarSherlock — Issue #206: action items keeps adding when changing orientation
Author: daverix
Created: 2012-01-26 21:17:28+00:00
State: open

When using a action items from a fragment and change portrait to landscape and back, I get multiple icons of the same actionItem in the fragment.

I'm adding the fragment to the activity in onCreate. Where I also have some other actionItems.

Code in fragment:

```java
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

setHasOptionsMenu(true);
}

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);

inflater.inflate(R.menu.fragment_week, menu);
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch(item.getItemId()) {
case R.id.menuRegister:
registerWeek();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
```