1

i have a application which uses drawer widget..so in that drawer js file i have a button which users can click and exit..but it is not working.

Here is my index.js file

var win = $.index;

here is my drawer.js file

var button = $.exit;

button .addEventListener('android:back',function(e) {
  win.close();
}); 

When the user click the button the app should exit..Thank you!

jehan
  • 79
  • 7

1 Answers1

0

'android:back' event is deprecated, you should use 'androidback' instead. So the proper drawer.js should look like this:

var button = $.exit;

button .addEventListener('androidback',function(e) { 
    Ti.Android.currentActivity.finish(); //this is a proper way to close the application in android
});
WeMakeSoftware
  • 9,039
  • 5
  • 34
  • 52