Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-12753] Android: Window fireEvent stop working when switching between heavyweight windows

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2014-01-29T00:06:01.000+0000
Affected Version/sn/a
Fix Version/sRelease 3.2.0
Componentsn/a
Labelsn/a
ReporterDavide Cassenti
AssigneeIngo Muschenetz
Created2013-02-15T16:48:28.000+0000
Updated2017-03-14T20:42:55.000+0000

Description

Problem description

Adding a custom event listener to a window, then closing and re-opening the window, does not fire the event.

Steps to reproduce

Use the following code; when switching between win2 and win1, the fireEvent does not work; it is working fine on iOS.
var win1 = Ti.UI.createWindow({
    backgroundColor: "#FFF",
    layout: "vertical",
    fullscreen: true
});

var win2 = Ti.UI.createWindow({
    backgroundColor: "#CCC",
    layout: "vertical",
    fullscreen: true
});

var addSwitchButton = function(caption, newWindow, oldWindow) {
    var switchButton = Ti.UI.createButton({
        title: caption,
        top: 50,
        height: 50
    });
    oldWindow.add(switchButton);
    switchButton.addEventListener("click", function(e) {
        newWindow.open({
            animated: false
        });
        oldWindow.close({
            animated: false
        });
        newWindow.fireEvent("customEvent", {
            firedFromButton: false
        });
    });
};

addSwitchButton("Switch to window 2.", win2, win1);
addSwitchButton("Switch to window 1.", win1, win2);

win1.addEventListener("customEvent", function(e) {
    Ti.API.info("Custom Event, fired from button: " + (e.firedFromButton ? "yes" : "no"));
});

var testButton = Ti.UI.createButton({
    title: "Fire custom event.",
    top: 50,
    height: 50
});
win1.add(testButton);
testButton.addEventListener("click", function(e) {
    win1.fireEvent("customEvent", {
        firedFromButton: true
    });
});

win1.open();

Comments

  1. Shak Hossain 2014-01-29

    Resolving this as per updated test results. We tested the issue with TISDK 3.2GA and we could not reproduce it.
  2. Lee Morris 2017-03-14

    Closing ticket as fixed.

JSON Source