John Error
John Error

Reputation: 2256

How can I auto dismiss Android VideoView on Dialog?

When I read a NFC tag, I play the video on videoview on dialog pop up. I want to dialog dismiss when the video finih. How can I code this?

Upvotes: 0

Views: 483

Answers (1)

Ken Wolf
Ken Wolf

Reputation: 23269

Set an OnCompletionListener on the VideoView.

In the onCompletion call, call dialog.dismiss()

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

VideoView.setOnCompletionListener(MediaPlayer.OnCompletionListener l)

Dialog.dismiss()

Upvotes: 1

Related Questions