Titanium JIRA Archive
Appcelerator Community (AC)

[AC-3109] Android: Hardware back-button does not function when "android:back" event listener is attached to heavyweight window

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionInvalid
Resolution Date2012-04-01T22:51:42.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsn/a
ReporterIvan Skugor
AssigneeFederico Casali
Created2012-02-24T01:46:45.000+0000
Updated2016-03-08T07:48:10.000+0000

Description

The problem

Heavyweight window can't be closed using hardware back-button when it has "android:back" event listener attached.

Test case

To see this problem run this example:

var win = Ti.UI.createWindow({
	backgroundColor: '#000'
});

var button = Ti.UI.createButton({
	title: 'Open window'
});

button.addEventListener('click', function() {
	
    var win1 = Ti.UI.createWindow({
    	title: 'Click back button',
    	modal: true,
    	backgroundColor: '#369'
    });
    
	win1.addEventListener('android:back', function() {
		Ti.API.info('Android:back');
	});
	
	win1.open();
	
});

win.add(button);

win.open();

Click on button and then try to close a window using hardware back-button. You should see that window did not close, while event has been fired as it can be seen in console output.

Expected behavior

Window needs to be closed when hardware back-button is clicked. Note that this works fine when example is compiled with 1.8.1 SDK.

Comments

  1. Ivan Skugor 2012-02-24

    Just to add ... it seems that tabgroup also can't be closed using hardware back-button when some window in it has "android:back" event attached.
  2. Ivan Skugor 2012-03-20

    This seems to be fixed in latest CI, so it can be closed.
  3. Federico Casali 2012-04-01

    Not able to reproduce. Please note that in the example above, the only result that should be noticed clicking on the back button is to display the 'Android:back' in the console log. To also close the window, 'win1.close()' should also be added in the eventListener.

JSON Source