[TIMOB-5036] Android: Event listener 'android:home' not working
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2011-08-17T13:57:06.000+0000 |
Affected Version/s | Release 1.7.2 |
Fix Version/s | Sprint 2011-33 |
Components | Android |
Labels | n/a |
Reporter | Anirudh Nagesh |
Assignee | Don Thorp |
Created | 2011-08-17T13:16:24.000+0000 |
Updated | 2014-06-19T12:46:21.000+0000 |
Description
Event listener for 'android:home' is not working.
1. Run the code below
Ti.UI.setBackgroundColor('#000');
var tabGroup = Ti.UI.createTabGroup();
var win1 = Ti.UI.createWindow({
backgroundColor:'white'
});
var tab1 = Ti.UI.createTab({
title:'Tab 1',
window:win1
});
var label1 = Ti.UI.createLabel({
color:'#999',
text:'click me',
top:20
});
win1.add(label1);
label1.addEventListener('click', function(){
var winHeavy = Ti.UI.createWindow({
title:'Heavywight Window',
backgroundColor:'blue',
fullscreen:false // this causes the window to be heavyweight
});
winHeavy.addEventListener('android:home', function(e) {
Ti.API.info("Pressing home Will Not Close The Activity/Window");
});
var label2 = Ti.UI.createLabel({
color:'white',
text:'Pressing the back button will test the Android back button event. Click this label to close this heavyweight window',
top:20
});
winHeavy.add(label2);
winHeavy.open();
});
var win2 = Ti.UI.createWindow({
title:'Tab 2',
backgroundColor:'green'
});
var tab2 = Ti.UI.createTab({
title:'Tab 2',
window:win2
});
tabGroup.addTab(tab1);
tabGroup.addTab(tab2);
tabGroup.open();
2. 'android:search' and 'android:back' are working as expected.
We do not document support of
android:home
and we do not support it in the [code](https://github.com/appcelerator/titanium_mobile/blob/master/android/titanium/src/org/appcelerator/titanium/TiBaseActivity.java#L402) it was intentionally not supported.