Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Handle back button in scrollableView

My app is all enclosed inside a ScrollView. When the user clicks the Android back button, I'd like to go back to the previews page of the scrollable view, instead of closing the app. The app should close only when the user clicks the back button while on page 0. Is this possible, and how?

like image 248
Dan Mazzini Avatar asked Apr 01 '26 21:04

Dan Mazzini


1 Answers

I found the answer: Use the android:back event AND set the main window as "modal: true"

var win = Titanium.UI.createWindow({  
  modal: true,
  exitOnClose:true
});

win.addEventListener('android:back', function (e) {
  // do what you want here
});
like image 52
Dan Mazzini Avatar answered Apr 03 '26 10:04

Dan Mazzini