[TIMOB-3158] Android: Activity indicator crashes app with "is your activity running?"
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-09-29T11:52:39.000+0000 |
Affected Version/s | Release 1.7.0, Release 1.6.2 |
Fix Version/s | Sprint 2011-31, Release 1.7.3, Release 1.8.0 |
Components | Android |
Labels | verified-1.7.3 |
Reporter | Thomas Huelbert |
Assignee | Vikramjeet Singh |
Created | 2011-04-15T03:38:18.000+0000 |
Updated | 2011-09-29T11:52:39.000+0000 |
Description
split off from #3099. Seen on a nexus s (2.3.1) running [INFO] Titanium SDK version: 1.6.0 (02/08/11 20:55 bd9d124...)
1.Mashups > YQL > YQL + Flickr
results: intermittent crash - pastie here: http://pastie.org/1550070">http://pastie.org/1550070
E/TiUncaughtHandler( 7825): android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@40512ad8 is not valid; is your activity running?
I've been having this error in my own code a lot! I have mitigated it some by reducing the number of activity indicators I am using and checking that the current activity is the same one as the one that the activity indicator will be created from. Very annoying as I use activity indicators a lot.
Perhaps this link will help the developers.
http://dimitar.me/android-displaying-dialogs-from-background-threads/"> http://dimitar.me/android-displaying-dialogs-from-background-threads/
Reproduction
I have a solid reproduction of this using activity indicators on Android here: https://gist.github.com/370939b6e54dadf6f5a9 Using that sample code, follow the on screen instructions and it should crash every time.Tested On
Samsung Epic 4G 2.2 BROKEN on 1.7.0 (04/05/11 10:30 731db9c...) BROKEN on 1.6.2 (03/30/11 17:25 0243d42...) BROKEN on 1.6.1 (03/09/11 10:58 6d9b0f3...)Crash Log
Associated Helpdesk Ticket
http://appc.me/c/APP-935438Associated Helpdesk Ticket
Another customer relies on this, http://appc.me/c/APP-935438 Whenever the app has been relaunched and attempts to show an activity indicator, this exception is produced.Environment Target
{noformat} + **Product**: Mobile + **Titanium SDK**: Mobile 1.7.1 + **Platform OS**: Android + **Platform OS Version**: 2.1+ {noformat}Crash Log
{noformat} android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@405162b8 is not valid; is your activity running? at android.view.ViewRoot.setView(ViewRoot.java:527) at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:177) at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91) at android.view.Window$LocalWindowManager.addView(Window.java:465) 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:44) at org.appcelerator.titanium.proxy.TiViewProxy.show(TiViewProxy.java:473) at ti.modules.titanium.ui.TiDialogProxy.access$001(TiDialogProxy.java:13) at ti.modules.titanium.ui.TiDialogProxy$1.onCurrentActivityReady(TiDialogProxy.java:31) at org.appcelerator.titanium.util.TiUIHelper$4.onPostOpen(TiUIHelper.java:152) at org.appcelerator.titanium.proxy.TiWindowProxy$1.run(TiWindowProxy.java:278) at android.os.Handler.handleCallback(Handler.java:587) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:123) at android.app.ActivityThread.main(ActivityThread.java:3835) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:507) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599) at dalvik.system.NativeStart.main(Native Method) {noformat}Same (or similar ) issue happens with Titanium.UI.createAlertDialog
Merged fix to both 1_7_X and master. Verified Dawson's test doesn't fail in 1_7_X or master.
Resolved. Tested on: Mac OSX Lion TiMob: 1.8.0.v20110906155354 TiStud: 1.0.5.201109091616 Devices Used: Android Emulator 2.2 Droid3 Google Nexus S
Verified fixed with OSX 10.6.8, Titanium Studio, build: 1.0.5.201109261308, SDK 1.7.3.v20110928185013, Emulator and Nexus S 2.3.4 using Dawson's sample code. Reclosing.