Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-2385] Android: tabGroup removeTab() method has no effect

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionInvalid
Resolution Date2017-05-02T20:11:46.000+0000
Affected Version/sRelease 3.0.0
Fix Version/sn/a
ComponentsAndroid
Labelsapi
ReporterPaul Dowsett
AssigneeIngo Muschenetz
Created2011-04-15T03:18:21.000+0000
Updated2017-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);

Comments

  1. John Luther 2011-04-15

    are you sure this is low priority? it does not work for platform.

  2. Don Thorp 2011-04-15

    The Android tab control does not support tab removal http://developer.android.com/reference/android/widget/TabHost.html"> TabHost

  3. Tyler 2011-04-15

    Are there any updates or workarounds to this? This seems like a pretty large bug to me..

  4. Don Thorp 2011-04-15

    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.

  5. Brian Kristiansen 2011-04-15

    It would be nice if the documentation said "iPhone only" like a lot of other functions/properties...

  6. Chris Whittle 2011-05-02

    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...
  7. Paul Dowsett 2011-05-03

    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.
  8. Paul Dowsett 2011-05-03

    See ticket TIMOB-3333
  9. Junaid Younus 2012-08-23

    Tested on a Samsung Galaxy S2 using TiSDK 2.2.0v20120821095711, issue still valid.
  10. Chad Gregory 2013-01-03

    Im not sure if this is a good workaround but couldn't you just hide the tab group?
  11. Lee Morris 2017-05-02

    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.

JSON Source