0

I made a game with icons and various levels. When I return to the Main Activity while I invite others to finish after a few seconds "app has stopped". And logCat is below ... If anyone knows why I've been looking a lot ...

    10-13 17:59:59.860 5022-5022/? E/AndroidRuntime: FATAL EXCEPTION: main
10-13 17:59:59.860 5022-5022/? E/AndroidRuntime: Process: com.vagreekscript.weebly.www.findthesimilarities, PID: 5022
10-13 17:59:59.860 5022-5022/? E/AndroidRuntime: android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@3befaab0 is not valid; is your activity running?
10-13 17:59:59.860 5022-5022/? E/AndroidRuntime:     at android.view.ViewRootImpl.setView(ViewRootImpl.java:575)
10-13 17:59:59.860 5022-5022/? E/AndroidRuntime:     at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:272)
10-13 17:59:59.860 5022-5022/? E/AndroidRuntime:     at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
10-13 17:59:59.860 5022-5022/? E/AndroidRuntime:     at android.app.Dialog.show(Dialog.java:306)
10-13 17:59:59.860 5022-5022/? E/AndroidRuntime:     at android.support.v7.app.AlertDialog$Builder.show(AlertDialog.java:902)
10-13 17:59:59.860 5022-5022/? E/AndroidRuntime:     at com.vagreekscript.weebly.www.findthesimilarities.SeventhLevel1$1.onFinish(SeventhLevel1.java:107)
10-13 17:59:59.860 5022-5022/? E/AndroidRuntime:     at android.os.CountDownTimer$1.handleMessage(CountDownTimer.java:127)
10-13 17:59:59.860 5022-5022/? E/AndroidRuntime:     at android.os.Handler.dispatchMessage(Handler.java:102)
10-13 17:59:59.860 5022-5022/? E/AndroidRuntime:     at android.os.Looper.loop(Looper.java:135)
10-13 17:59:59.860 5022-5022/? E/AndroidRuntime:     at android.app.ActivityThread.main(ActivityThread.java:5274)
10-13 17:59:59.860 5022-5022/? E/AndroidRuntime:     at java.lang.reflect.Method.invoke(Native Method)
10-13 17:59:59.860 5022-5022/? E/AndroidRuntime:     at java.lang.reflect.Method.invoke(Method.java:372)
10-13 17:59:59.860 5022-5022/? E/AndroidRuntime:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:909)
10-13 17:59:59.860 5022-5022/? E/AndroidRuntime:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:704)
Dilberted
  • 1,172
  • 10
  • 23
  • In your main activity, did you call `finish` before going to the next screen? – d0nut Oct 13 '15 at 15:14
  • 1
    The problem is here: com.vagreekscript.weebly.www.findthesimilarities.SeventhLevel1$1.onFinish(SeventhLevel1.java:107) -- post your code. It almost looks like you're trying to display a dialog box while the activity is finishing – Jim Oct 13 '15 at 15:14
  • The dialog will be displayed after the count down timer will finish, but i cancel the timer on a button that finish activity... Thanks in Advance – Vagelis Agelousis Oct 13 '15 at 15:25
  • I think Jim you are right... In this activity i didn't cancel the countdown timer returning to main... Thank you so much!!! – Vagelis Agelousis Oct 13 '15 at 15:37
  • And something else... Is it right to use System.gc() in onDestroy() to free some allocated memory or i will have performance problems? – Vagelis Agelousis Oct 13 '15 at 15:54
  • Possible duplicate of [Unable to add window -- token android.os.BinderProxy is not valid; is your activity running?](http://stackoverflow.com/questions/9529504/unable-to-add-window-token-android-os-binderproxy-is-not-valid-is-your-activ) – EJK Oct 13 '15 at 15:56

0 Answers0