如何在Dialog上自动关闭Android VideoView?

时间:2013-12-10 10:57:51

标签: android dialog popup android-videoview

当我读取NFC标签时,我会弹出视频对话框中的视频。我想在视频播放时对话解除。我该如何编码呢?

1 个答案:

答案 0 :(得分:1)

OnCompletionListener上设置VideoView

onCompletion来电中,致电dialog.dismiss()

videoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
    @Override
    public void onCompletion(MediaPlayer mp) {
        dialog.dismiss();    
    }
});

VideoView.setOnCompletionListener(MediaPlayer.OnCompletionListener l)

Dialog.dismiss()