Problem
When you "Kill" an app after a syntax error occurs at runtime (the red/white error dialog), the screen goes black and the app hangs, instead of dying off. Clicking the Android "back" button at that point does nothing.
Testcase
Create a new mobile project and paste in the code that follows.
Run the app on the Android 2.2 emulator.
Press the "Next Window" button.
Press the "Cause error" button. As expected, this causes a red/white syntax error to occur.
Click the "Kill" button.
*The screen goes black and does not respond.*
To see a different result, change the {noformat}if (false){noformat} in Button1Click to {noformat}if (true){noformat} and run the app again.
Press the "Next Window" button. As expected, this causes a red/white syntax error to occur.
Click the "Kill" button.
You will see that this time, the app restarts itself (is it really supposed to do this, or is it supposed to just die off?).
Ti.UI.createWindow({url:'win1.js',
exitOnClose:true,
navBarHidden:true
}).open();
var win1=Ti.UI.currentWindow;
var Button1=Ti.UI.createButton({title:'Next Window'});
function Button1Click()
{
if (false) // make this true to see a crash restart the app
Button1.title=dne; // force a crash
Ti.UI.createWindow({url:'win2.js',
exitOnClose:false,
navBarHidden:true
}).open();
}
Button1.addEventListener('click',Button1Click);
win1.add(Button1);
var CrashWin=Ti.UI.currentWindow;
var CrashButton=Ti.UI.createButton({title:'Cause error'});
function CrashButtonClick()
{
CrashButton.title=dne; // force a crash
}
CrashButton.addEventListener('click',CrashButtonClick);
CrashWin.add(CrashButton);
Verified that this is fixed in SDK 2.0.0.v20120319003254.
Customer confirmed the fix in 2.0