[TIMOB-2385] Android: tabGroup removeTab() method has no effect
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2017-05-02T20:11:46.000+0000 |
Affected Version/s | Release 3.0.0 |
Fix Version/s | n/a |
Components | Android |
Labels | api |
Reporter | Paul Dowsett |
Assignee | Ingo Muschenetz |
Created | 2011-04-15T03:18:21.000+0000 |
Updated | 2017-05-02T21:13:05.000+0000 |
Description
The following usecase demonstrates that the removeTab() method currently does not work. In the code, I've created a button that listens for a click event that attempts to remove tab2 using removeTab(tab2), so any output can be observed using logcat. The tab is not removed. I've also tried removeTab outside of the eventlistener, both before and after the tabgroup is opened, with the same result.
var tabGroup1 = 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 button1 = Ti.UI.createButton({
title:'close tab',
top:100,
height:30,
width:120
});
win1.add(button1);
var win2 = Titanium.UI.createWindow({
title:'Tab 2',
backgroundColor:'#fff'
});
var tab2 = Titanium.UI.createTab({
icon:'KS_nav_ui.png',
title:'Tab 2',
window:win2
});
button1.addEventListener('click', function(e){
tabGroup1.removeTab(tab2);
});
tabGroup1.addTab(tab1);
tabGroup1.addTab(tab2);
tabGroup1.open();
tabGroup1.removeTab(tab2);
are you sure this is low priority? it does not work for platform.
The Android tab control does not support tab removal http://developer.android.com/reference/android/widget/TabHost.html"> TabHost
Are there any updates or workarounds to this? This seems like a pretty large bug to me..
I repeat the Android native control DOES NOT support the remove of tabs. Until they do or we build the entire control it's not going to be fixed.
The workaround is to design your application such that you don't need to remove tabs.
It would be nice if the documentation said "iPhone only" like a lot of other functions/properties...
Is there any kind of workaround for this? We are working on an app that if we can get through it will build up to us purchasing a support package...
As Don has clearly stated, there is no native way to remove a tab. The closest is [clearAllTabs](http://developer.android.com/reference/android/widget/TabHost.html#clearAllTabs()), but the resulting effect when used in an app of removing all tabs and recreating/adding new tabs would not good. Thus, this ticket will not be resolved, so propose that it be closed.
See ticket TIMOB-3333
Tested on a Samsung Galaxy S2 using TiSDK 2.2.0v20120821095711, issue still valid.
Im not sure if this is a good workaround but couldn't you just hide the tab group?
Resolving ticket as Invalid as there is now a new version of Kitchen Sink available and we no longer support the version which relates to this ticket.