Project: titanium
Issue TIMOB-17715: Android: Cannot open new window after last window closes
After closing the last window on Android, when attempting to open a new window, the app crashes with the "Unfortunately app has stopped" message. Here is the stack trace that I get: {noformat} E/AndroidRuntime( 2450): FATAL EXCEPTION: main E/AndroidRuntime( 2450): Process: com.appdev.test, PID: 2450 E/AndroidRuntime( 2450): java.lang.NullPointerException E/AndroidRuntime( 2450): android.content.ComponentName.(ComponentName.java:77) E/AndroidRuntime( 2450): android.content.Intent.(Intent.java:3813) E/AndroidRuntime( 2450): ti.modules.titanium.ui.WindowProxy.handleOpen(WindowProxy.java:128) E/AndroidRuntime( 2450): org.appcelerator.titanium.proxy.TiWindowProxy.handleMessage(TiWindowProxy.java:88) E/AndroidRuntime( 2450): ti.modules.titanium.ui.WindowProxy.handleMessage(WindowProxy.java:399) E/AndroidRuntime( 2450): android.os.Handler.dispatchMessage(Handler.java:98) E/AndroidRuntime( 2450): android.os.Looper.loop(Looper.java:136) E/AndroidRuntime( 2450): android.app.ActivityThread.main(ActivityThread.java:5017) E/AndroidRuntime( 2450): java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime( 2450): java.lang.reflect.Method.invoke(Method.java:515) E/AndroidRuntime( 2450): com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) E/AndroidRuntime( 2450): com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) E/AndroidRuntime( 2450): dalvik.system.NativeStart.main(Native Method) {noformat} Here is the test case that I am using: {code:javascript} var openWindow = function(index) { var window = Ti.UI.createWindow({ backgroundColor: 'white', title: 'Window ' + index }); var button = Ti.UI.createButton({ width: 80, height: 40, title: 'Button' }); button.addEventListener('click', function() { window.close(); openWindow(index + 1); }); window.add(button); window.open(); }; openWindow(1); {code} It successfully closes the first window but crashes when attempting to open the second window. It works when opening the second window before closing the first.
Story points: 2