android.view.WindowLeaked

If you like a tip written by other Samebug users, mark is as helpful! Marks help our algorithm provide you better solutions and also help other users.
tip

Close (finish) a Activity before, to ensure that the subsidiary in the above Dialog or PopupWindow have been closed (dismiss).
Is also available at OnCreateDialog (Dialog) to create, let the system to manage the dialog box

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

  • {html}<div><h1>Problem</h1> <p>When an alert dialog and a modal window are launched at the same time, they end up racing each other to see who displays first. This causes an exception to be thrown.</p> <h1>Regression</h1> <p>In 1.5.0, the alert dialog would show over the modal window, and no exception would be thrown. This has been introduced since then.</p> <h1>Sample Code</h1> <pre> <code class= "javascript">var tabGroup = Titanium.UI.createTabGroup(); // main window var tmpWindow = Titanium.UI.createWindow({ backgroundColor: 'green', }); var tmpTab = Titanium.UI.createTab({ window:tmpWindow, title:'first' }); tabGroup.addTab(tmpTab); tabGroup.open(); Login = {}; Login.loginDialog = Ti.UI.createWindow({ backgroundColor: 'red', }); Login.loginDialog.open({modal:true}); var alertDialog = Titanium.UI.createAlertDialog({ title: 'Welcome', message: 'Stuff in here', buttonNames: ['red pill', 'blue pill'] }); alertDialog.show();</code> </pre> <h1>Trace Log</h1> <pre> <code>[TRACE] E/WindowManager( 586): Activity org.appcelerator.jss.JssActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@43ec9740 that was originally added here [TRACE] E/WindowManager( 586): android.view.WindowLeaked: Activity org.appcelerator.jss.JssActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@43ec9740 that was originally added here [TRACE] E/WindowManager( 586): at android.view.ViewRoot.&lt;init&gt;(ViewRoot.java:247) [TRACE] E/WindowManager( 586): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:148) [TRACE] E/WindowManager( 586): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91) [TRACE] E/WindowManager( 586): at android.view.Window$LocalWindowManager.addView(Window.java:424) [TRACE] E/WindowManager( 586): at android.app.Dialog.show(Dialog.java:241) [TRACE] E/WindowManager( 586): at ti.modules.titanium.ui.widget.TiUIActivityIndicator.handleShow(TiUIActivityIndicator.java:200) [TRACE] E/WindowManager( 586): at ti.modules.titanium.ui.widget.TiUIActivityIndicator.show(TiUIActivityIndicator.java:124) [TRACE] E/WindowManager( 586): at ti.modules.titanium.ui.ActivityIndicatorProxy.handleShow(ActivityIndicatorProxy.java:45) [TRACE] E/WindowManager( 586): at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:212) [TRACE] E/WindowManager( 586): at android.os.Handler.dispatchMessage(Handler.java:95) [TRACE] E/WindowManager( 586): at android.os.Looper.loop(Looper.java:123) [TRACE] E/WindowManager( 586): at android.app.ActivityThread.main(ActivityThread.java:4627) [TRACE] E/WindowManager( 586): at java.lang.reflect.Method.invokeNative(Native Method) [TRACE] E/WindowManager( 586): at java.lang.reflect.Method.invoke(Method.java:521) [TRACE] E/WindowManager( 586): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) [TRACE] E/WindowManager( 586): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) [TRACE] E/WindowManager( 586): at dalvik.system.NativeStart.main(Native Method)</code> </pre> <h1>Workaround</h1> <p>The workaround is to remove the race -- only open one, and when it is finished, launch the second. Therefore, the workaround for the sample code would be the following (thanks belong to Marshall Culpepper for this workaround):</p> <pre> <code class= "javascript">Login.loginDialog.addEventListener("open", function(e) { var alertDialog = Titanium.UI.createAlertDialog({ title: 'Welcome', message: 'Stuff in here', buttonNames: ['red pill', 'blue pill'] }); alertDialog.show(); }); Login.loginDialog.open({ modal: true });</code> </pre> <h1>Tested On</h1> <p>Titanium SDK version: 1.6.0 (02/10/11 14:34 9db0685...)<br> BROKEN on Android Simulator 2.2</p> <h2>Associated Helpdesk Ticket</h2> <p><a href= "http://developer.appcelerator.com/helpdesk/view/72761">http://developer.appcelerator.com/helpdesk/view/72761</a></p></div>{html}
    via by Dawson Toth,
  • {html}<div><h1>Problem</h1> <p>When an alert dialog and a modal window are launched at the same time, they end up racing each other to see who displays first. This causes an exception to be thrown.</p> <h1>Regression</h1> <p>In 1.5.0, the alert dialog would show over the modal window, and no exception would be thrown. This has been introduced since then.</p> <h1>Sample Code</h1> <pre> <code class= "javascript">var tabGroup = Titanium.UI.createTabGroup(); // main window var tmpWindow = Titanium.UI.createWindow({ backgroundColor: 'green', }); var tmpTab = Titanium.UI.createTab({ window:tmpWindow, title:'first' }); tabGroup.addTab(tmpTab); tabGroup.open(); Login = {}; Login.loginDialog = Ti.UI.createWindow({ backgroundColor: 'red', }); Login.loginDialog.open({modal:true}); var alertDialog = Titanium.UI.createAlertDialog({ title: 'Welcome', message: 'Stuff in here', buttonNames: ['red pill', 'blue pill'] }); alertDialog.show();</code> </pre> <h1>Trace Log</h1> <pre> <code>[TRACE] E/WindowManager( 586): Activity org.appcelerator.jss.JssActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@43ec9740 that was originally added here [TRACE] E/WindowManager( 586): android.view.WindowLeaked: Activity org.appcelerator.jss.JssActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@43ec9740 that was originally added here [TRACE] E/WindowManager( 586): at android.view.ViewRoot.&lt;init&gt;(ViewRoot.java:247) [TRACE] E/WindowManager( 586): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:148) [TRACE] E/WindowManager( 586): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91) [TRACE] E/WindowManager( 586): at android.view.Window$LocalWindowManager.addView(Window.java:424) [TRACE] E/WindowManager( 586): at android.app.Dialog.show(Dialog.java:241) [TRACE] E/WindowManager( 586): at ti.modules.titanium.ui.widget.TiUIActivityIndicator.handleShow(TiUIActivityIndicator.java:200) [TRACE] E/WindowManager( 586): at ti.modules.titanium.ui.widget.TiUIActivityIndicator.show(TiUIActivityIndicator.java:124) [TRACE] E/WindowManager( 586): at ti.modules.titanium.ui.ActivityIndicatorProxy.handleShow(ActivityIndicatorProxy.java:45) [TRACE] E/WindowManager( 586): at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:212) [TRACE] E/WindowManager( 586): at android.os.Handler.dispatchMessage(Handler.java:95) [TRACE] E/WindowManager( 586): at android.os.Looper.loop(Looper.java:123) [TRACE] E/WindowManager( 586): at android.app.ActivityThread.main(ActivityThread.java:4627) [TRACE] E/WindowManager( 586): at java.lang.reflect.Method.invokeNative(Native Method) [TRACE] E/WindowManager( 586): at java.lang.reflect.Method.invoke(Method.java:521) [TRACE] E/WindowManager( 586): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) [TRACE] E/WindowManager( 586): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) [TRACE] E/WindowManager( 586): at dalvik.system.NativeStart.main(Native Method)</code> </pre> <h1>Workaround</h1> <p>The workaround is to remove the race -- only open one, and when it is finished, launch the second. Therefore, the workaround for the sample code would be the following (thanks belong to Marshall Culpepper for this workaround):</p> <pre> <code class= "javascript">Login.loginDialog.addEventListener("open", function(e) { var alertDialog = Titanium.UI.createAlertDialog({ title: 'Welcome', message: 'Stuff in here', buttonNames: ['red pill', 'blue pill'] }); alertDialog.show(); }); Login.loginDialog.open({ modal: true });</code> </pre> <h1>Tested On</h1> <p>Titanium SDK version: 1.6.0 (02/10/11 14:34 9db0685...)<br> BROKEN on Android Simulator 2.2</p> <h2>Associated Helpdesk Ticket</h2> <p><a href= "http://developer.appcelerator.com/helpdesk/view/72761">http://developer.appcelerator.com/helpdesk/view/72761</a></p></div>{html}
    via by Dawson Toth,
  • FATAL EXCEPTION: AsyncTask #1 in android
    via Stack Overflow by Nick
    ,
  • JSON Parsing in android by appending a data
    via by Unknown author,
  • JSON Parsing for a simple listview in android
    via by Unknown author,
  • Upload Video with Android Intent Crashes
    via Stack Overflow by user992374
    ,
    • android.view.WindowLeaked: Activity org.appcelerator.jss.JssActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@43ec9740 that was originally added here at android.view.ViewRoot.&lt;init&gt;(ViewRoot.java:247) at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:148) at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91) at android.view.Window$LocalWindowManager.addView(Window.java:424) at android.app.Dialog.show(Dialog.java:241) at ti.modules.titanium.ui.widget.TiUIActivityIndicator.handleShow(TiUIActivityIndicator.java:200) at ti.modules.titanium.ui.widget.TiUIActivityIndicator.show(TiUIActivityIndicator.java:124) at ti.modules.titanium.ui.ActivityIndicatorProxy.handleShow(ActivityIndicatorProxy.java:45) at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:212) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:123) at android.app.ActivityThread.main(ActivityThread.java:4627) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:521) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)

    Users with the same issue

    filipebatistafilipebatista
    1 times, last one,
    SacchiSacchi
    2 times, last one,
    Hiren AmaliyarHiren Amaliyar
    1 times, last one,
    Indri YunitaIndri Yunita
    8 times, last one,
    winer222winer222
    1 times, last one,
    71 more bugmates