[AC-2220] Android: displayHomeAsUp and onCreateOptionsMenu together are broken
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Cannot Reproduce |
Resolution Date | 2014-01-19T08:07:27.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | actionbar, android |
Reporter | Thomas Keunebroek |
Assignee | Shak Hossain |
Created | 2013-01-14T08:23:09.000+0000 |
Updated | 2016-03-08T07:41:13.000+0000 |
Description
When you open a heavyweight Window from a TabGroup's tab and set the new window's Activity's ActionBar's displayHomeAsUp property to true, the Activity.onCreateOptionsMenu() callback is never called, therefore the menu items are not created.
Code snippet:
var win = Ti.UI.createWindow({
title: 'New win',
backgroundColor: 'white'
});
var activity = win.getActivity();
win.addEventListener('open', function() {
activity.actionBar.setDisplayHomeAsUp(true);
});
activity.onCreateOptionsMenu = function(e) {
var menu = e.menu;
menu.add({
title: 'Your action',
showAsAction: Ti.Android.SHOW_AS_ACTION_ALWAYS
});
};
yourTab.open(win);
If we remove the line that sets displayHomeAsUp to true, the menuItem is correctly drawn.
The test case that you've provided contains errors. Could you please provide a valid test case?
Here you go: app.js
tiapp.xml
If you run the above code snippet, you'll see that you don't have any options menu created. However, if you don't set the up affordance by commenting the line
, you will get your action. Those two features should be working at the same time without any problem. I hope it's clearer this way. Regards,
Hello, We tested this issue with your test code using the latest 3.1.3 GA. We can’t reproduce this issue in Ti SDK 3.1.3GA. It is most likely fixed. Please test your issue using the latest release and let us know your feedback.
Testing Environment:
OS: MAC OS X 10.8.5 Ti SDK: 3.0.0/3.1.3GA Android SDK 4.2.2 Thanks