Titanium JIRA Archive
Appcelerator Community (AC)

[AC-2581] can not close lightweight windows on android

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionInvalid
Resolution Date2013-08-23T18:17:27.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsandroid
Reporteruser
AssigneeMauro Parra-Miranda
Created2013-08-21T04:42:21.000+0000
Updated2016-03-08T07:41:39.000+0000

Description

There is a problem to close lightweight windows on android, and this can be easily reproduced with the following code. In the example, four windows with different color are created, and will be close with back key, but only the latest windows can be closed, the other three can not. var red = Ti.UI.createWindow({ backgroundColor : 'red', top:0, height:100, }); red.addEventListener('android:back', function() { red.close(); }); red.open(); var blue = Ti.UI.createWindow({ backgroundColor : 'blue', top:100, height:100, }); blue.addEventListener('android:back', function() { blue.close(); }); blue.open(); var yellow = Ti.UI.createWindow({ backgroundColor : 'yellow', top:200, height:100, }); yellow.addEventListener('android:back', function() { yellow.close(); }); yellow.open(); var green = Ti.UI.createWindow({ backgroundColor : 'green', top:300, height:100, }); green.addEventListener('android:back', function() { green.hide(); }); green.open();

Comments

  1. Jamie Buckley 2013-08-23

    Hi, I tried to reproduce this and noticed that the reason the other windows were not being closed is because you were not closing the green window, Instead it was being hidden:
       green.hide();
       
    Once I changed this I was able to close all the windows with the back button, I hope this helps. P.S. I noticed you are using the android:back event which was deprecated in Titanium 3.0.0 and so may not be behave as expected, instead you should use androidback
  2. Mauro Parra-Miranda 2013-11-24

    The user was using hide instead of close.

JSON Source