It's part of that zip file, but here is the contents of my activity, my
app's manifest and the xml for the menu items:
MainActivity.java:
package com.example.optionsmenu;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.ViewGroup;
import android.widget.TextView;
public class MainActivity extends Activity {
private ViewGroup mContainer;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mContainer = (ViewGroup) findViewById(R.id.container);
}
@Override
public final boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_a:
case R.id.action_b:
case R.id.action_c:
case R.id.action_d:
case R.id.action_e:
case R.id.action_f:
case R.id.action_g:
case R.id.action_h:
final TextView textview = new TextView(this);
textview.setText(item.getTitle());
mContainer.addView(textview);
return true;
default:
return super.onOptionsItemSelected(item);
}
}
}
AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.optionsmenu"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="9" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar" >
<activity
android:name="com.example.optionsmenu.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
main.xml:
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/action_a"
android:title="@string/action_a"/>
<item
android:id="@+id/action_b"
android:title="@string/action_b"/>
<item
android:id="@+id/action_c"
android:title="@string/action_c"/>
<item
android:id="@+id/action_d"
android:title="@string/action_d"/>
<item
android:id="@+id/action_e"
android:title="@string/action_e"/>
<item
android:id="@+id/action_f"
android:title="@string/action_f"/>
<item
android:id="@+id/action_g"
android:title="@string/action_g"/>
<item
android:id="@+id/action_h"
android:title="@string/action_h"/>
</menu>
On Wednesday, August 7, 2013 2:40:37 PM UTC-5, Nobu Games wrote:
>
> Could you post your Activity code?
>
> On Tuesday, August 6, 2013 11:01:17 AM UTC-5, Jay Howard wrote:
>>
>> I'm seeing the following behavior (on a Samsung S4, but potentially also
>> on other Samsung devices) in an app that uses a "legacy" options menu:
>>
>> 1. User taps hardware menu button to bring up options menu. There are
>> more than six items in the menu.
>> 2. User taps the bottom-right "more" button to access the overflow menu
>> items.
>> 3. User taps the hardware back button to return to the initial options
>> menu.
>> 4. User taps any combination of menu items, potentially multiple times
>> each. Nothing happens. onOptionsItemSelected() is never called.
>> 5. User taps the hardware back button to close the options menu.
>> 6. User taps the hardware menu button to display the options menu again.
>> At this point, onOptionsItemSelected() is called in quick succession for
>> each menu item the user tapped when the menu was previously displayed.
>>
>> Can anyone advise?
>>
>> I've created a simple demo app to demonstrates the behavior along with a
>> video that shows exactly what I'm talking about. There's also a screenshot
>> with device info for the device I tested on. I've shared them here:
>>
>> https://drive.google.com/folderview?id=0B6DvDY2BvxUTRUNxWFVUNDl4QlU
>>
>> The demo app implements onCreateOptionsMenu() and onOptionsItemSelected()
>> nearly identically to the examples given here:
>>
>> http://developer.android.com/guide/topics/ui/menus.html#options-menu
>>
>> I posted this question on StackOverflow a while back, but none of the
>> responses were helpful:
>>
>>
>> http://stackoverflow.com/questions/17180909/options-menu-locks-up-on-galaxy-s4
>>
>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.