Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-2713] exitOnclose event not working in android

GitHub Issuen/a
TypeBug
PriorityTrivial
StatusClosed
ResolutionCannot Reproduce
Resolution Date2017-03-24T17:45:57.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAndroid
Labelsandroid, exitonclose
ReporterLakshmanan
AssigneeNeeraj Gupta
Created2011-04-15T03:27:37.000+0000
Updated2017-03-31T17:21:37.000+0000

Description

I want to exit from application from one screen. When i click the android hardware back button from that screen the application should be exit. I tried this with exitOnclose within window creation but it doesn't work.

This is my code:

var win2 = Titanium.UI.createWindow({

title:'Tab 2',
url:'example.js',
backgroundColor:'#fff',

exitOnClose:true,

        navBarHidden:false

});

I am using Titanium version 1.5.1 and android:sdk 2.1 also I tested with titanium 1.4.0

Comments

  1. krishnan 2011-04-15

    Did someone find a solution for this?

  2. skypanther 2011-04-15

    Have you added an event listener on the back button?

    var win = Titanium.UI.currentWindow;
    function closeWindow() {

       win.close();
       

    } if(Titanium.Platform.name == 'android') {

       win.addEventListener('android:back', closeWindow);
       

    } // end platform test

  3. Stephen Tramer 2011-04-15

    Assigning to Don for triage.

  4. Junaid Younus 2012-08-24

    Tested on a Samsung Galaxy S2 using TiSDK 2.2.0v20120821095711, unable to reproduce the issue. Ticket marked as resolved.
       var win = Ti.UI.createWindow({backgroundColor: 'white'});
       
       win.addEventListener('click', function(e)
       {
           var win2 = Ti.UI.createWindow({backgroundColor: 'yellow', exitOnClose: true});
           
           win2.open();
       });
       
       win.open();
       
  5. Lee Morris 2017-03-31

    Closing ticket as I am unable to reproduce the issue using the following environment; Pixel (7.1) MacOS 10.11.6 (15G31) Studio 4.8.1.201612050850 Ti SDK 6.0.3 GA Appc NPM 4.2.8 Appc CLI 6.1.0 Ti CLI 5.0.11 Alloy 1.9.5 Arrow 1.10.1 Xcode 8.2 (8C38) Node v4.6.0 Java 1.7.0_80

JSON Source