Titanium Community Questions & Answer Archive

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

Android TabGroup behavior? If drilled down under a tab, easy way to get home?

In Android, opening a new window in a tab always seems to open a new, full-screen window rather than keeping the tabs visible. The behavior is quite plainly seen if you run the KitchenSink app. When you click any item in the table under the main window on one of the tabs, a new window is opened in the tab, and it obscures the tabs. (On iPhone the tabs remain and you even get a nice breadcrumb in the window title.)

I haven't discovered a way to keep the tabs by opening a new window. Is it possible? Or, if I want to keep the tabs visible, will I have to just use different views within that main tab window and show/hide them as necessary?

Lastly, back to a case with the original question, if you have opened another window in a tab, and the tabs are gone, is there any way to get back to the app root quickly, or to switch to another tab quickly? I've also seen that calling setActiveTabButton if you're in a fullscreen window will set the tab, but the window doesn't change. Tabs just seem wonky under Android.

— asked September 23rd 2010 by Christopher Rumpf
  • activetab
  • android
  • fullscreen
  • tabgroup
  • window
0 Comments

2 Answers

  • Christopher

    I can appreciate the reasons for your desire to make your UI on android look and feel identical to the iphone. I can admit sometimes avoiding platform-specific UI components with the aim of simplifying dev time and codebase. The hard reality is that, by doing so, it risks alienating one or both of the target audiences.

    Android users won't recognise the tabgroup behavior that you have observed when running iphone apps, and so are less likely to find it intuitive. This is why, as you have mentioned, KS tabs and windows behave in the way they do on android, where commands like Ti.UI.currentTab.open(win,{animated:true}), which seem to imply that the window will appear within the tabgroup, actually open as heavyweight, modal, windows.

    Incidentally, I've seen on a number of occasions Appcelerator's recommendation to implement stacks of views in favour of creating new windows. Maybe you could try to achieve your aim using this approach. If you do, on android you would probably want to listen to the back button event listener so that users don't inadvertently exit the app rather than returning to the previous view.

    If you are still certain you want the window to appear within the current tab, you can actually fudge/hack the behaviour by opening a lightweight, non-modal, window. To do this, create the window without any navBarHidden, fullscreen or any other modal options, and simply open it, ie win.open().

    — answered November 17th 2010 by Paul Dowsett
    permalink
    1 Comment
    • on win.open and Ti.UI.currentTab.open(win,{animated:true}), open full window without tabgroup any solution.?

      — commented October 23rd 2012 by Jayesh Joshi
  • You could assign the new window as a url to the current tab and then put in a back button that would reassign it to the original window.

    So you would have Tab 1 that has 'url:tab1.js', when you click something in tab1.js it assigns tab2.js to the Tab 1 url value.

    — answered November 17th 2010 by Kevin
    permalink
    0 Comments
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.