I have a problem with my Android app. The activity has an options menu.
The menu looks like this:
<menu
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:title="@string/tx_1"
android:id="@+id/menu_1"
>
<menu>
<group android:checkableBehavior="single">
<item
android:title="@string/tx_2"
android:id="@+id/menu_2"
/>
<item
android:title="@string/tx_3"
android:id="@+id/menu_3"
/>
</group>
<item
android:title="@string/tx_4"
android:id="@+id/menu_4"
android:checkable="true"
/>
</menu>
</item>
<item
android:title="@string/tx_5"
android:id="@+id/menu_5"
/>
</menu>
So there is a SubMenu when you click on the first item. It looks like a dialog, but I cannot find a way to get a reference to this dialog. When I rotate the device, there is a leaked window-error. So, it seems like Android is not closing the SubMenu. Is there a way to prevent this error? The SubMenu disappears, of course, after recreating, triggered by the orientation change. I can reopen the options menu, but not the SubMenu. Is it possible to simulate a click on the first menu item?
Thanks in advance!
And by the way, I don't want to bypass the rotation by changing the manifest.