Skip to content

Instantly share code, notes, and snippets.

@csemrm
Created March 2, 2014 06:04
Show Gist options
  • Save csemrm/9302616 to your computer and use it in GitHub Desktop.
Save csemrm/9302616 to your computer and use it in GitHub Desktop.
Android: Working example for setActive tab
var win1 = Ti.UI.createWindow({
title : 'Win 1'
});
var button = Ti.UI.createButton({
color : '#000',
style : Ti.UI.iPhone.SystemButtonStyle.BORDERED,
title : 'Set Active Tab 1'
});
button.addEventListener('click', function(e) {
tabGroup.setActiveTab(1);
//Ti.API.info('****************** activeTab: ' + tabGroup.activeTab);
});
win1.add(button);
var tab1 = Ti.UI.createTab({
icon : 'KS_nav_ui.png',
title : 'Tab 1',
window : win1
});
var win2 = Ti.UI.createWindow({
title : 'Win 2'
});
var tab2 = Ti.UI.createTab({
icon : 'KS_nav_views.png',
title : 'Tab 2',
window : win2
});
var tabGroup = Ti.UI.createTabGroup({
});
tabGroup.addTab(tab1);
tabGroup.addTab(tab2);
tabGroup.addEventListener('open', function(e) {
tabGroup.setActiveTab(1);
Ti.API.info('****************** activeTab: ' + tabGroup.activeTab);
});
tabGroup.setActiveTab(1);
tabGroup.open();
//Ti.API.info('********************* activeTab: ' + tabGroup.activeTab);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment