App closes when you tap the Back button, it should go back
Android/Windows/SDK 1.4
My app closes when you press the back button–the curvy-left-arrow on the phone/emulator (not a button defined w/in my app). I want it go back to the previously opened window.
app.js - switcher that opens one of a few windows based on prior use of the app
mainwin.js - defines & opens the main window of the application
profile.js - defines a window listing profiles created by the user
A button tap in mainwin.js opens profile.js with statements like this:
Titanium.include('profile.js');
profilewin.open();
With the profile window open, if you tap the back button, the app should go back to the main window (defined in mainwin.js) but instead it closes.
I see the exitOnClose: true
property, which I've set for only the window definition in mainwin.js. If I set that property to false
, how do I specify which window/file would be opened?
Tim
1 Answer
-
Accepted Answer
You may want to try something like this on the current window
win.addEventListener('android:back', function() { win.close(); });
Just note the window has to be a "heavyweight" window. (window called with either fullscreen, modal, or tabBarHidden - but they can be false)