Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-829] Android: Menu isn't visible/doesn't work for tabbed windows.

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-04-17T01:54:22.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.6.0 M06
ComponentsAndroid
Labelsandroid, defect, release-1.6.0
ReporterDon Thorp
AssigneeJeff Haynie
Created2011-04-15T02:37:20.000+0000
Updated2011-04-17T01:54:22.000+0000

Description

The problem is that the Activity that creates the menu isn't always the current activity that has access to the menu.

Comments

  1. Don Thorp 2011-04-15

    Click FAIL re-assigning to me instead of Jeff.

  2. Don Thorp 2011-04-15

    Reports of it's operation being intermittent as well even with single Windows.

  3. Don Thorp 2011-04-15

    This may no longer be valid.

  4. Bill Dawson 2011-04-15

    This is eons old and the menu system has changed for the better since then. I see no problem with menus in tabbed window contexts. My test case app.js, win1.js and win2.js:

    app.js:

       Titanium.UI.setBackgroundColor('#000');
       var tabGroup = Titanium.UI.createTabGroup();
       var win1 = Titanium.UI.createWindow({  
           title:'Tab 1',
           backgroundColor:'#fff',
           url: 'win1.js'
       });
       var tab1 = Titanium.UI.createTab({  
           icon:'KS_nav_views.png',
           title:'Tab 1',
           window:win1
       });
       
       var win2 = Titanium.UI.createWindow({  
           title:'Tab 2',
           backgroundColor:'#fff',
           url: 'win2.js'
       });
       var tab2 = Titanium.UI.createTab({  
           icon:'KS_nav_ui.png',
           title:'Tab 2',
           window:win2
       });
       
       tabGroup.addTab(tab1);  
       tabGroup.addTab(tab2);  
       tabGroup.open();
       

    win1.js:

       var win = Ti.UI.currentWindow;
       
       var activity = Ti.Android.currentActivity;
       activity.onCreateOptionsMenu = function(e) {
           var m = e.menu.add({title: 'Win 1 Item 1'});
           m.addEventListener('click', function(){alert('Win 1 Item 1 click');});
       };
       win.add(Ti.UI.createLabel({text: 'Press menu and you should see "Win 1 Item 1"'}));
       

    win2.js:

       var win = Ti.UI.currentWindow;
       
       var activity = Ti.Android.currentActivity;
       activity.onCreateOptionsMenu = function(e) {
           var m = e.menu.add({title: 'Win 2 Item 1'});
           m.addEventListener('click', function(){alert('Win 2 Item 1 click');});
       };
       win.add(Ti.UI.createLabel({text: 'Press menu and you should see "Win 2 Item 1"'}));
       
  5. Don Thorp 2011-04-15

    Verified on G1/1.6 and Nexus One/2.2.1 using build #e1cb22a

JSON Source