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?
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
-
// 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); });
-
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?