Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9482] Android: close event listener is not added when called inside an open event

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionCannot Reproduce
Resolution Date2013-03-19T06:22:12.000+0000
Affected Version/sRelease 2.0.1
Fix Version/sRelease 3.0.2
ComponentsAndroid
Labelsapi
ReporterDavide Cassenti
Assigneejithinpv
Created2012-06-11T11:28:13.000+0000
Updated2017-03-21T21:50:35.000+0000

Description

Problem description

Adding a listener for the 'close' event inside an 'open' event is not working. Other events (e.g. 'click' works fine)

Steps to reproduce

1. create an app with the code below 2. open the app and click on the button: a new window opens 3. click the back button: the close event is not fired
var win = Ti.UI.createWindow ({
    title: "Win",
    background: 'black'
});

var btn = Ti.UI.createButton ({
    title: 'click me',
    left: 10,
    right: 10,
    top: 20
});

btn.addEventListener ('click', function (e) {
    var win2a = Ti.UI.createWindow ({
        backgroundColor: '#ccf',
        layout: 'vertical'
    });
    win2a.addEventListener ('open', function (e) {
        win2a.addEventListener ('close', function (e) {
            Ti.API.debug ('event: close');
            alert('this will now show up');
        });
    });

    win2a.open();
});

win.add (btn);

win.open();

Additional Notes

Note that the event is not added at all: calling a different function inside the 'open' event works just find; also, replacing 'close' with 'click' works fine. Customer ticket: http://support.appcelerator.com/tickets/APP-646612

Comments

  1. jithinpv 2013-03-19

    Issue does not reproduces with Titanium Studio, build: 3.0.1.201212181159 Titanium SDK version: 3.1.0 (03/11/13 15:43 0c88429) Titanium SDK version: 3.0.2 (02/07/13 16:46 a4def81) Device: Samsung galaxy s duos Android version: 4.0.4 jithinpv
  2. Lee Morris 2017-03-21

    Closing ticket as the issue cannot be reproduced and due to the above comments.

JSON Source