I have written these lines of code:
mVideoView = (VideoView) findViewById(R.id.video_view);
mVideoView.setOnClickListener(new OnClickListener() {
@O
Here's how I solved the pause/play of VideoViews using onTouch:
// Class variables
private boolean bVideoIsBeingTouched = false;
private Handler mHandler = new Handler();
vvVideo.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (!bVideoIsBeingTouched) {
bVideoIsBeingTouched = true;
if (vvVideo.isPlaying()) {
vvVideo.pause();
} else {
vvVideo.resume();
}
mHandler.postDelayed(new Runnable() {
public void run() {
bVideoIsBeingTouched = false;
}
}, 100);
}
return true;
}
});