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.<init>(ViewRoot.java:247)

Appcelerator JIRA | Dawson Toth | 6 years ago
  1. 0

    {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}

    Appcelerator JIRA | 6 years ago | Dawson Toth
    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)
  2. 0

    {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}

    Appcelerator JIRA | 6 years ago | Dawson Toth
    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)
  3. 0

    FATAL EXCEPTION: AsyncTask #1 in android

    Stack Overflow | 3 years ago | Nick
    android.view.WindowLeaked: Activity com.paper.solution.Downloadpdf has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@4052ee20 that was originally added here at android.view.ViewRoot.&lt;init&gt;(ViewRoot.java:258)
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    JSON Parsing in android by appending a data

    Stack Overflow | 3 years ago
    android.view.WindowLeaked: Activity com.project.findmybuffet.AndroidTabRestaurantDescSearchListView has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@405b70f8 that was originally added here at android.view.ViewRoot.&lt;init&gt;(ViewRoot.java:258)
  6. 0

    Android JSON null pointer exception error and android.view.WindowLeaked

    Stack Overflow | 3 years ago | Vaibhav
    android.view.WindowLeaked: Activity com.wise.ezzie_taxie.AndroidGPSTrackingActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@45fcf4c0 that was originally added here at android.view.ViewRoot.&lt;init&gt;(ViewRoot.java:247)
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. 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()
  2. Android Platform
    Dialog.show
    1. android.view.WindowManagerImpl.addView(WindowManagerImpl.java:148)
    2. android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
    3. android.view.Window$LocalWindowManager.addView(Window.java:424)
    4. android.app.Dialog.show(Dialog.java:241)
    4 frames
  3. ti.modules.titanium
    ActivityIndicatorProxy.handleShow
    1. ti.modules.titanium.ui.widget.TiUIActivityIndicator.handleShow(TiUIActivityIndicator.java:200)
    2. ti.modules.titanium.ui.widget.TiUIActivityIndicator.show(TiUIActivityIndicator.java:124)
    3. ti.modules.titanium.ui.ActivityIndicatorProxy.handleShow(ActivityIndicatorProxy.java:45)
    3 frames
  4. org.appcelerator.titanium
    TiViewProxy.handleMessage
    1. org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:212)
    1 frame
  5. Android Platform
    ActivityThread.main
    1. android.os.Handler.dispatchMessage(Handler.java:95)
    2. android.os.Looper.loop(Looper.java:123)
    3. android.app.ActivityThread.main(ActivityThread.java:4627)
    3 frames
  6. Java RT
    Method.invoke
    1. java.lang.reflect.Method.invokeNative(Native Method)
    2. java.lang.reflect.Method.invoke(Method.java:521)
    2 frames
  7. Android
    ZygoteInit.main
    1. com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
    2. com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
    2 frames