Why don't multiple Titanium.App.fireEvent() calls work in Android from Titanium Appcelerator?
In Titanium Appcelerator, I have a project that creates a tabGroup and window via a function.
Ti.App.addEventListener('startCoSelect', function(e) {
// store user name and password globally
// user = e.user;
// pass = e.pass;
tabs.close();
tabs = tms.ui.createCoSelectGroup();
tabs.open();
});
Ti.App.addEventListener('startAppHome', function(e) {
tabs.close();
tabs = tms.ui.createApplicationTabGroup();
tabs.open();
});
var tabs = tms.security.getPermission();
tabs.open();
Within this function is a button, this button has an event listener assigned to it that then calls Ti.App.fireEvent('startCoSelect').
btnLogin.addEventListener("click", function (e) {
Ti.App.fireEvent('startCoSelect');
});
From this event listener a function is called that opens a new tabGroup and window as well as closing the previous tab group as shown above. Inside of the tabGroup created by tms.ui.createCoSelectGroup() is another eventlistener that fires another event
btnSelect.addEventListener("click", function (e) {
Ti.App.fireEvent开发者_StackOverflow中文版('startAppHome');
});
and once again another event listener and fireEvent call within the tms.ui.createApplicationTabGroup() function.
I am developing and testing all code within Titanium Studio with Titanium sdk 1.7 using the continuous/nightly builds of both on Mac OS X 10 as well as a completely updated Android and iOS sdk.
My issue is only within Android. The mobile app works perfectly as it should on iPhone. However, on Android (testing with 2.2 API's emulator) I can only fire one event. As an example, the android application will accept the first button "click" event fine and fire the event but then the next fireEvent call (activated by the next button press) will not fire.
I know that the "click" event is firing, by placing an alert inside of each Event Listener, and that it has to be the fireEvent call.
I also know that it doesn't have anything to do with the order of the calls. If I change which event is fired first it will always fire the first one and it will always refuse the fireEvent calls that follow. An example being that I changed which tabGroup and window was opened at launch and the first button click and fireEvent work then afterwards, even though the next click events are registered, the fireEvent call is not.
The Trace and console give no answers or error codes and I am left with only a button that does nothing unless I place an alert or function inside. I have tried having the function call Ti.App.fireEvent() and it doesn't change.
I may be able to post code via pastie but I need to remove crucial information before posting it so it may take a day.
All help is appreciated.
精彩评论