Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-11796] Android: ActionBar not getting set on Tab windows

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2014-08-15T22:45:20.000+0000
Affected Version/sn/a
Fix Version/sRelease 3.0.2, Release 3.1.0, 2012 Sprint 26 Core, 2012 Sprint 26
ComponentsAndroid
Labelsmodule_actionbar, qe-automation, qe-port, triage
ReporterArthur Evans
AssigneeAllen Yeung
Created2012-11-15T23:58:31.000+0000
Updated2014-08-15T22:45:20.000+0000

Description

It appears that the action bar is not getting added to the window activity when you create a tab group. For example, this code works if win is a standard window:
win.addEventListener('open', function() {
    var actionBar = win.activity.actionBar;
    actionBar.title = 'TITANIUM APP';
});
However, if win is a tab window, it fails because actionBar is undefined.

Comments

  1. Shannon Hicks 2012-11-16

    This ticket is either related to, or a duplicate of, TIMOB-11766 I filed my bug because the TabGroup is actually a Window under the covers, and the tabs' "windows" are actually views. Following that logic, I found TabGroup.activity.actionBar
  2. Igor Santos 2012-11-16

    this is, indeed, a subset of your bug. Why don't you relate it too to TIMOB-11601?
  3. Arthur Evans 2012-11-19

    Shannon, I'm not able to duplicate you results on TabGroup.activity.actionBar. Running against both 3.0.X and master, when I try to access TabGroup.activity, it's undefined. I tried waiting for the tab group open event or the window open event, no go. What code are you using to access that tab group's activity? And what build are you running against?
  4. Arthur Evans 2012-11-19

    NM. I figured out that TabGroup.getActivity() was working, but it wasn't properly exposed as a property, so TabGroup.activity was showing up as undefined. So, if you use getActivity(), you can access the action bar _and_ set action items. If you use window.activity on a tab group, you can only set action items. A little weird. At a minimum, we should expose TabGroup.activity.
  5. Allen Yeung 2012-12-04

    Test case:
       Titanium.UI.setBackgroundColor('#000');
       
       // create tab group
       var tabGroup = Titanium.UI.createTabGroup();
       
       var win1 = Titanium.UI.createWindow({  
           title:'Tab 1',
           backgroundColor:'#fff'
       });
       var tab1 = Titanium.UI.createTab({  
           icon:'KS_nav_views.png',
           title:'Tab 1',
           window:win1
       });
       
       var label1 = Titanium.UI.createLabel({
       	color:'#999',
       	text:'I am Window 1',
       	font:{fontSize:20,fontFamily:'Helvetica Neue'},
       	textAlign:'center',
       	width:'auto'
       });
       
       win1.add(label1);
       
       tabGroup.addTab(tab1);  
       
       // open tab group
       tabGroup.open();
       
       tabGroup.addEventListener('open', function(){
       	var activity = tabGroup.activity;
       	if (activity) {
       		Ti.API.info('----------------------successfully grabbed activity');
       	} else {
       		Ti.API.info('----------------------didnt grab activity');	
       	}
       });
       
    1. Run the code above 2. Look at logcat and you should see the success message
  6. Allen Yeung 2012-12-04

    PR: https://github.com/appcelerator/titanium_mobile/pull/3520
  7. Thomas Keunebroek 2012-12-13

    Following this issue, it's a really annoying one.
  8. Shyam Bhadauria 2013-01-21

    Environment used for verification - Titanium SDK: 3.1.0.v20130114171802 Titanium  Studio:3.0.1.201212181159 Device: Samsung GALAXY Note (2.3.6)
  9. Vishal Duggal 2013-01-21

    Reopening to edit fixVersion

JSON Source