Back button won't work when VideoView is playing video

后端 未结 1 515
独厮守ぢ
独厮守ぢ 2021-01-20 03:21

I have a VideoView in one of my Activities and if I try to press the back Button it doesn\'t take me to the previous Activity

相关标签:
1条回答
  • 2021-01-20 04:18

    From CommansWare

    Based on the source code, this should work:

    1. Extend MediaController (for the purposes of this answer, call it RonnieMediaController)
    2. Override dispatchKeyEvent() in RonnieMediaController
    3. Before chaining to the superclass, check for KeyEvent.KEYCODE_BACK, and if that is encountered, tell your activity to finish()
    4. Use RonnieMediaController instead of MediaController with your VideoView

    Personally, I'd just leave it alone, as with this change your user cannot make a RonnieMediaController disappear on demand.

    Here is the link to the original post.

    0 讨论(0)
提交回复
热议问题