Thursday, August 8, 2013

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

Hi,

I downloaded, unzipped & built you app in Eclipse from the source, without any alterations. It did run OK on my Samsung Galaxy S4 (Android V4.2.2).

It did *not* exhibit the issues you originally mentioned, all menu items working ok with the text for each item showing up ok & immediately for the various key combinations include selecting 'more' and pressing that hardware back button then pressing the original menu options, all was ok.

I have attached a screenshot showing the device details used for this test. It's a 4G LTE 'international' version and is an 'unlocked' device, not rooted & not from a carrier, it came out of Hong Kong, I am using it in Australia.

Perhaps the issue is specific to some subset of these devices?

Regards
,
On Wednesday, August 7, 2013 11:48:28 PM UTC+10, Jay Howard wrote:
How frustrating.  Though, I'm glad to know it works for someone else; it gives me some hope that a workaround can be found.

Couple questions about the app that's working correctly:

1. What's the value of "targetSdkVersion" in your manifest?  (Mine is "9").
2. What's the value of "target" in your project.properties file?  (Mine is "Google Inc.:Google APIs:14").
3. Do you use a default theme for your app?  If so, which?  (Mine is "Theme.NoTitleBar").

Is there any chance I could impose on you to build and run my demo app ("OptionsMenu.zip" shared on Google Drive) on your S4?  The zip file contains a complete Eclipse project minus the "bin" and "gen" dirs, which are auto-generated.  The app is trivial and does nothing but demonstrate the bad behavior.

If possible, I'd like to determine whether this is an issue on all S4s or if the device I'm using is "special" in some way.

On Wednesday, August 7, 2013 3:51:02 AM UTC-5, gjs wrote:
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.


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