Android: Best Practice for back button

You must Login before you can answer or comment on any questions.

Hi, in my little project I have the structure above:

Ti.UI.createWindow().open();       // Window with login form
Ti.App.addEventListener('login:sucessfull',function(){
    Ti.UI.createTabGroup().open();
});
Two questions:

  • how can I hanlde hardware backbutton to close tabgroup (and go back to login)
  • how can I terminate app with back button ???

Sorry for my stupide question - it is my firsat Android project ;-))

Rainer

1 Answer

Accepted Answer

Add an event listener 'android:back' that closes the window or tab group.

myWindow.addEventListener('android:back', function(){
    this.close();
};

Your Answer

Think you can help? Login to answer this question!