Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-6144] Android: Ability change the Tab titles dynamically

GitHub Issuen/a
TypeNew Feature
PriorityHigh
StatusClosed
ResolutionCannot Reproduce
Resolution Date2013-11-06T09:45:55.000+0000
Affected Version/sSprint 2011-45, Release 1.8.0.1
Fix Version/s2013 Sprint 23, 2013 Sprint 23 API
ComponentsAndroid
Labelstbs-1.9.0
ReporterKarol Pomaski
AssigneeIngo Muschenetz
Created2011-11-10T13:24:57.000+0000
Updated2017-03-27T18:30:03.000+0000

Description

Feature Request

Ability to change the title on Tabs from TabGroup. It can be done natively. Some native code that points out that this is both possible and simple:
((TextView)mTabHost.getTabWidget().getChildAt(0).findViewById(android.R.id.title)).setText("New");
Explanation: We grab the object of the TabGroup widget then we point that we need the first child (first tab starting from the left). Next step using this part of code: findViewById(android.R.id.title)) we find the text label (that refers to the Tab). It give us the ability to operate on it like with normal Label. We can change the text using the setText method.

Associated HelpDesk Ticket

http://appc.me/c/APP-796146

Comments

  1. Joel Hulen 2011-12-05

    I would like to draw attention to this issue as it affects me greatly with how I am trying to dynamically change the labels of the native tabGroup on Android devices after they have been set. Please provide some sort of timeline or resolution plan for this. As you can see in the feature request, the appropriate code has already been provided. If you need help testing this, I'd be more than willing to be one of the testers. Thanks for your attention to this matter. Joel
  2. Don Thorp 2011-12-05

    The fix is not simply that line of code. Also, we cannot accept the code attached to JIRA as a contributor license agreement must be signed by anyone contributing code. There are procedures in the wiki for submitting pull requests.
  3. dit k 2011-12-05

    OK so what is your suggestion, is there any workarounds? If User changes the Language he have to restart the App? ehmm... Changing the Label of a widget is a simple and natural feature. I hope it will be fixed, the Message "Please restart your App" is very unprofessional.
  4. Biju pm 2013-11-06

    testcase
        var win1 = Ti.UI.createWindow({
           title: 'Win 1'
       });
         
       var tab1 = Ti.UI.createTab({  
           title: 'PRODUCTS',
          window: win1
       });
        var btn = Ti.UI.createButton({title: "chane title", top: 20,left : 30});
               btn.addEventListener('click', function(e) {
                        tab1.title = "change title";
                         tab2.title = "change title tab2";
                       });
                       win1.add(btn);
       var win2 = Ti.UI.createWindow({
           title: 'Win 2'
       });
         
       var tab2 = Ti.UI.createTab({  
           title: 'List SUMMARY',
           window: win2
       });
        
       var tabGroup = Ti.UI.createTabGroup({
           title: 'Group Test' 
            
       });
              
       tabGroup.addTab(tab1);
       tabGroup.addTab(tab2);
         
       tabGroup.open();
       
  5. Biju pm 2013-11-06

    Cant reproduce this issue .
  6. Lee Morris 2017-03-27

    Closing ticket as I am unable to reproduce this issue with the following environment; Pixel (7.1) MacOS 10.11.6 (15G31) Studio 4.8.1.201612050850 Ti SDK 6.0.3 GA Appc NPM 4.2.8 Appc CLI 6.1.0 Ti CLI 5.0.11 Alloy 1.9.5 Arrow 1.10.1 Xcode 8.2 (8C38) Node v4.6.0 Java 1.7.0_80

JSON Source