Android Question howto use videoview on overlaywindow

analizer3816

Member
Licensed User
Longtime User
I want to create video player on overlaywindow
i can add videoview(audio library) without error
but i have a problem is it can play and can see video
but it shows force closed

android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is your activity running?
at android.view.ViewRootImpl.setView(ViewRootImpl.java:849)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:337)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
at android.widget.MediaController.show(MediaController.java:379)
at android.widget.MediaController.show(MediaController.java:329)
at android.widget.VideoView$2.onPrepared(VideoView.java:484)
at android.media.MediaPlayer$EventHandler.handleMessage(MediaPlayer.java:3690)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7229)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
 

analizer3816

Member
Licensed User
Longtime User
problem resolved
I start overlay window from activity(former i start from service), videoview can play video on overlay window (no force closed)
when I press home button
 
Upvote 0
Top