[AC-2581] can not close lightweight windows on android
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2013-08-23T18:17:27.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | android |
Reporter | user |
Assignee | Mauro Parra-Miranda |
Created | 2013-08-21T04:42:21.000+0000 |
Updated | 2016-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();
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:
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
The user was using hide instead of close.