Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

How can I open another window after closing a tabGroup?

Hello!
Now, I create Android Application and I want to show a View after closing a tabGroup.
Please tell me how I can do it?

— asked November 9th 2010 by masa ochi
  • android
  • tabgroup
2 Comments
  • what code have your written so far? Please post it.

    — commented November 9th 2010 by Aaron Saunders
  • It really depends what you want to achieve, masa - there are a number of scenarios.

    Talk us through how your application works (in terms of windows and views) from the app.js upwards and maybe someone can suggest an approach you could take.

    As Aaron rightly questioned, where is your code?

    — commented November 9th 2010 by Paul Dowsett

3 Answers

  • Accepted Answer

    Masa

    Once a tabgroup is open, it cannot be closed, due to this ticket. If it is closed, on android anyway, you just see a black blank screen, and you cannot recover from it.

    If you create and open a window, then the new window will appear in the active tab (even though it has not been added as a tab to the group), with the tabgroup navigation showing above.

    If you set the navBarHidden: true property on that window and then open it, it will fill the whole screen covering the tabs.

    Hope this helps

    — answered November 10th 2010 by Paul Dowsett
    permalink
    0 Comments
  • // Define the Window
    var win = Titanium.UI.createWindow({
        title:'Window',
        backgroundColor:'#fff'
    });
    
    var view1 = Titanium.UI.createView({ /*.....*/});
    var view2 = Titanium.UI.createView({ /*.....*/});
    var button = TItanium.UI.createButton{( /*.....*/});
    
    var tabGroup = Titanium.UI.createTabGroup();
    
    var win1 = Titanium.UI.createWindow({ /*.....*/});
    view1.add(button);
    win1.add(view1);
    var tab1 = Titanium.UI.createTab({ 
     window: win1,
     /*.....*/
    });
    
    var win2 = Titanium.UI.createWindow({ /*.....*/});
    var tab2 = Titanium.UI.createTab({ 
     window: win2,
     /*.....*/
    });
    
    
    tabGroup.addTab(tab1);  
    tabGroup.addTab(tab2);
    
    if (Titanium.Platform.name == 'iPhone OS'){
     win.add(tabGroup);
    }
    tabGroup.open();
    
    button.addEventListener('click', function(){
     tabGroup.close();
    });
    
    tabGroup.addEventListener('close', function(e){
     win.add(view2);
    });
    
    — answered November 10th 2010 by masa ochi
    permalink
    1 Comment
    • Masa

      This is not an answer - you should either edit/update your original question, or post it as a reply comment to one of the requests for more info.

      — commented November 10th 2010 by Paul Dowsett
  • The "navBarHidden: true" worked!
    Thank you Hal H!!

    Actually, after open a new window, I want to use "android:back" like this.

    win.addEventListener('android:back', function(e){
        return false;
    });
    

    But it doesn't work.
    What should I do?

    — answered November 11th 2010 by masa ochi
    permalink
    3 Comments
    • If you want to use android:back you should use SDK 1.5

      — commented November 11th 2010 by Jacob van Dam
    • SDK 1.5.0 didn't work.

      — commented November 11th 2010 by masa ochi
    • I asked in here.

      — commented November 11th 2010 by masa ochi
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.