Wednesday, August 7, 2013

[android-developers] Re: buggy legacy options menu on Samsung S4

Hi,

I have a Samsung Galaxy S4 with Android 4.2.2 plus an app & activities that have legacy option menus with more than six items, including "more" that uses onCreateOptionsMenu() as well as onPrepareOptionsMenu() and onOptionsItemSelected().

When I try to reproduce your steps I do *not* get the same issues you mention, all menu options work OK when using the key combinations you mention.

The main difference I can see when looking at your code sample on SO, is that I do *not* use an inflator to inflate the menu items from a static xml file in onCreateOptionsMenu(). 

Instead I am creating the menu (& sub menu) items in java code dynamically at runtime, within onCreateOptionsMenu() & also onPrepareOptionsMenu(), adding & removing menu items to & from the menu object 'by hand', the reason I'm doing this is that the menu items need to vary according to the current context of the activity, perhaps you could try the same & see if that works ok on an S4.

Another suggestion, instead of creating menu items dynamically at runtime in java code - which is probably not a recommended practice, is to try your inflator code within onPrepareOptionsMenu(), remembering to call menu.clear() before the inflator and see if that works any better.

See for details http://developer.android.com/reference/android/app/Activity.html#onPrepareOptionsMenu(android.view.Menu)

Good luck.

On Wednesday, August 7, 2013 2:01:17 AM UTC+10, 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
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 android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment