[AC-2806] Window.activity property does not exist if navBarHidden is not set
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2012-03-26T12:09:26.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | 1.8.2, 2.0.0, activity, android, menu |
Reporter | Justin Toth |
Assignee | Mauro Parra-Miranda |
Created | 2012-02-16T07:52:00.000+0000 |
Updated | 2016-03-08T07:47:43.000+0000 |
Description
If you create a window and do not set the navBarHidden property on it, then the activity property will not exist on the window so you cannot do things like create menus. The code below will error due to win.activity not existing. Uncomment the navBarHidden property and then rerun and the menu will successfully be created.
var win = Ti.UI.createWindow({
backgroundColor: "#fff"
//navBarHidden: true
});
win.open();
Ti.API.info(win);
Ti.API.info(win.activity);
var activity = win.activity;
activity.onCreateOptionsMenu = function(e){
var menu = e.menu;
var menuItem = menu.add({ title: "Item 1" });
menuItem.addEventListener("click", function(e) {
Ti.API.debug("I was clicked");
});
};
This can be closed as expected behavior. A window is only an activity in itself if it's heavyweight, which occurs if navBarHidden is set.
Invalid issue.