Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-16184] Android: TabGroup setActiveTab not working if tabs are added with addTab method

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2014-03-23T23:41:42.000+0000
Affected Version/sRelease 3.2.0
Fix Version/s2014 Sprint 06, 2014 Sprint 06 SDK, Release 3.3.0
ComponentsAndroid
Labelsandoid, module_tabgroup, qe-closed-3.2.3, qe-testadded
ReporterNadav Hoze
AssigneeBiju pm
Created2014-01-12T20:34:09.000+0000
Updated2014-07-26T06:14:35.000+0000

Description

Steps to reproduce: 1. Create a tabgroup and add 2 or more tabs via tabGroup.addTab method. 2. set tab 1 as active tab via tabGroup.setActiveTab method 3. open tabgroup. Expected result: tabgroup is open and active tab is #1. Actual Result: tabgroup is open and active tab is #0. Here is a code snippet:
(function() {
	 var tabGroup = Ti.UI.createTabGroup({
});
var tab0 = Titanium.UI.createTab({
    window:Ti.UI.createWindow({title: "win0"}),
    title:'Tab 0',
});
tabGroup.addTab(tab0);
 
var tab1 = Titanium.UI.createTab({
    window:Ti.UI.createWindow({title: "win1"}),
    title:'Tab 1',
});
tabGroup.addTab(tab1);
 
var tab2 = Titanium.UI.createTab({
    window:Ti.UI.createWindow({title: "win2"}),
    title:'Tab 2',
});
tabGroup.addTab(tab2);
 
tabGroup.setActiveTab(1);
 
tabGroup.open();
	
		
})();


When tabGroup is open you'll see the following log message: [ERROR] : TabGroupProxy: (KrollRuntimeThread) [353,353] Invalid tab index.

Comments

  1. Ritu Agrawal 2014-01-14

    Moving this ticket to engineering as I can reproduce this issue with the provided test case on Samsung Galaxy Nexus device.
  2. Biju pm 2014-01-15

    PR:- https://github.com/appcelerator/titanium_mobile/pull/5219
  3. Neha Mittal 2014-04-18

    Verified fix with following environment: Appc Studio: 3.2.3.201404162038 SDK build: 3.2.3.v20140417162517 and 3.3.0.v20140417173316 acs: 1.0.14 npm: 1.3.2 alloy:1.3.1 CLI: titanium@3.2.3-beta titanium-code-processor:1.1.1-beta1 Xcode: 5.1.1 Osx: Mavericks(10.9.2) Device: Nexus 7 (4.3) and Nexus 5 (4.4.2) Tabgroup is now open and active tab is #1. Hence closing the issue.

JSON Source