Titanium JIRA Archive
Appcelerator Community (AC)

[AC-2806] Window.activity property does not exist if navBarHidden is not set

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionInvalid
Resolution Date2012-03-26T12:09:26.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labels1.8.2, 2.0.0, activity, android, menu
ReporterJustin Toth
AssigneeMauro Parra-Miranda
Created2012-02-16T07:52:00.000+0000
Updated2016-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");
  });
};

Comments

  1. Justin Toth 2012-02-17

    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.
  2. Mauro Parra-Miranda 2013-11-24

    Invalid issue.

JSON Source