I have written these lines of code:
mVideoView = (VideoView) findViewById(R.id.video_view);
mVideoView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Log.v("LOG_TAG, click");
}
});
However, when I run my application, the click event is never called.
So I wonder, is it impossible to register an OnClickListener on a VideoView? And, if so, why is that the case?
use
VideoView.setOnTouchListener(..)
it works for VideoViewThe VideoView is a wrapper containing mdeiaplayer and surfaceView. You can interact with through MediaController or writing your own SurfaceView and implement onClick events.
I realize this is an old question but thought I'd chime in with an easy workaround. I can't answer why this doesn't work - seems like a big oversight in my opinion. But an easy workaround is to place your VideoView as the sole View inside a FrameLayout, and set an OnClickListener on the layout. Not ideal, but it works.
It is possible I have did this with onSetClickListener. And Here's a code for your help: