Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24305] Android: androidback window, tabgroup event does not fired in SDK 6.0.1.GA, 6.0.0.GA, This works fine for SDK 5.5.1.GA.

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionDuplicate
Resolution Date2017-01-12T21:44:54.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAndroid
Labelsn/a
ReporterItay Avtalyon
AssigneeEric Merriman
Created2017-01-12T17:53:34.000+0000
Updated2017-03-24T18:34:57.000+0000

Description

Window's android back event handler is faulty or event not functioning at all. Compare the following code with version 6* of the SDK with version 5.5.1.GA where it works. Sample code: var win1 = Titanium.UI.createWindow({ backgroundColor : "white", }); // Add to the parent view. win1.add(aWebView); win1.addEventListener('androidback', function () { alert("Don't go!"); }); win1.open(); Expected behaviour: When back button clicked in Android, the application should remain open and the alert be shown. Actual behaviour: Application closes and the alert is never displayed.

Comments

  1. Sharif AbuDarda 2017-01-12

    Hello, I can verify the issue with the sample code below in SDK 6.0.1.GA, 6.0.0.GA, 5.5.1.GA with Android 6.0.1 device.
       var win1 = Titanium.UI.createWindow({
           backgroundColor : "white",
       });
       
       win1.addEventListener('androidback', function() {
           alert("Don't go!");
       });
       
       win1.open();
       
    androidback event not fired in SDK 6.0.1.GA. This works fine for SDK 5.5.1.GA. Now, I have tried with "windows:back" instead of "androidback' http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.Window-event-androidback too. Same result. I even tried it for tabgroup, androidback event not fired in SDK 6.0.1.GA, 6.0.0.GA. This works fine for SDK 5.5.1.GA.
       var win1 = Ti.UI.createWindow({
           backgroundColor: 'blue',
           title: 'Blue'
       });
       win1.add(Ti.UI.createLabel({text: 'I am a blue window.'}));
       
       var win2 = Ti.UI.createWindow({
           backgroundColor: 'red',
           title: 'Red'
       });
       win2.add(Ti.UI.createLabel({text: 'I am a red window.'}));
       
       var tab1 = Ti.UI.createTab({
           window: win1,
           title: 'Blue'
       }),
       tab2 = Ti.UI.createTab({
           window: win2,
           title: 'Red'
       }),
       tabGroup = Ti.UI.createTabGroup({
           tabs: [tab1, tab2]
       });
       tabGroup.open();
       
       tabGroup.addEventListener('androidback', function() {
           alert("Don't go!");
       });
       
    To sum up, androidback event not fired on both window and tabgroup in SDK 6.0.1.GA, 6.0.0.GA. This works fine for SDK 5.5.1.GA.
  2. Hans Knöchel 2017-01-12

    Already fixed for 6.1.0 in TIMOB-24253
  3. Lee Morris 2017-03-24

    Closing ticket as duplicate with reference to the linked issues.

JSON Source