When i hide tabgroup on my login screen the application crashes

You must Login before you can answer or comment on any questions.

Hello,

I'm trying to make a login screen with one button that directs the user to the register form. I made the login screen using a tutorial, so i'm trying to hide the tabgroup when the login screen is showing and when a user logs in the tabgroup will become visible. But when i remove the account and register tabgroup the application does not work anymore.

// this sets the background color of the master UIView (when there are no windows/tab groups on it) Titanium.UI.setBackgroundColor('#fff');

var tabGroup = Titanium.UI.createTabGroup(); var main = Titanium.UI.createWindow(); var mainTab = Titanium.UI.createTab();

var DateFeedWindow = require('ui/DateFeedWindow'); var BroadcastWindow = require('ui/BroadcastWindow'); var MessagesWindow = require('ui/MessagesWindow'); var MyprofileWindow = require('ui/MyprofileWindow');

var login = Titanium.UI.createWindow({ title:'Mingle', url:'ui/login.js' });

var loginTab = Titanium.UI.createTab({ title:"Login", window:login });

var account = Titanium.UI.createWindow({ title:'New Account', url:'ui/account.js' });

var accountTab = Titanium.UI.createTab({ title:'New Account', window:account });

//MAIN NAVIGATIE WINDOWS var win1 = new DateFeedWindow(L('Datefeed')); var win2 = new BroadcastWindow(L('Your Broadcast')); var win3 = new MessagesWindow(L('Messages')); var win4 = new MyprofileWindow(L('My Profile'));

var tab1 = Ti.UI.createTab({ title: L('Datefeed'), icon: '/images/KS_nav_ui.png', window: win1 }); win1.containingTab = tab1;

var tab2 = Ti.UI.createTab({ title: L('Broadcast'), icon: '/images/KS_nav_views.png', window: win2 }); win2.containingTab = tab2;

var tab3 = Ti.UI.createTab({ title: L('Messages'), icon: '/images/KS_nav_views.png', window: win3 }); win3.containingTab = tab3;

var tab4 = Ti.UI.createTab({ title: L('My Profile'), icon: '/images/KS_nav_views.png', window: win4 }); win3.containingTab = tab4;

tabGroup.addTab(loginTab); tabGroup.addTab(accountTab); tabGroup.open();

Ti.App.addEventListener('grantEntrance', function(event) { main.tabBarHidden = true; main.title = 'Welcome ' + event.name; main.url = 'ui/ResultWindow.js'; main.name = event.name; main.email = event.email; mainTab.window = main;

tabGroup.removeTab(accountTab);
tabGroup.removeTab(loginTab);
tabGroup.addTab(tab1);
tabGroup.addTab(tab2);
tabGroup.addTab(tab3);
tabGroup.addTab(tab4);

});

1 Answer

It happens on Android, but not on iPhone so kindly hold your tabGroup within a window and add exitOnclose() property to make its weight more and at time of closing open

NewWindow.add(tabGroup)
tabGroup.open();
Then when closing
NewWindow.open();
 
NewWindow.removeTab(tabGroup);
tabGroup.close();
This will work on Android.

Refer to this question [Refer] (http://developer.appcelerator.com/question/139857/tabgroupclose-doesnt-work-on-android)

Your Answer

Think you can help? Login to answer this question!