-2
android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@ec2d125 is not valid; is your activity running?

im use service in background, show notification

ibrahim
  • 9
  • 1
  • 3
  • 1
    Add error log and code here. – DHAVAL A. Jun 04 '19 at 15:43
  • 1
    well, is your activity running? This usually happens when you try to display a dialog or something after the activity has already finished. You would need to add more details for us to diagnose your problem accurately though. – Steven Jun 04 '19 at 15:43
  • app is work fine, some time i have this error, im use AsyncTask in background service – ibrahim Jun 04 '19 at 16:21
  • 1
    If your app is crashing then evidently it is not "working fine". Like I said, if you are using services or asynctask, you should check and see if the activity is finishing or finished before interacting with it. – Steven Jun 04 '19 at 17:11
  • I want to display the entire code but when I edit the question the error message appears It looks like your post is mostly code; please add some more details. – ibrahim Jun 04 '19 at 17:15
  • @ibrahim Check the context while you are creating.Change Context test once. – Narender Reddy Jun 05 '19 at 10:59

1 Answers1

0

It's kinda hard to help you out because we need more information But as Steven said this usually happens when you are showing the dialog for a context that no longer exists, like "show dialog" after an async operation and during that operation the original activity is destroyed.

Take a look at this Unable to add window — token android.os.BinderProxy is not valid; is your activity running?

Dor
  • 657
  • 1
  • 5
  • 11