Android: Why can't I give an onClickListener to a VideoView?

前端 未结 11 2151
独厮守ぢ
独厮守ぢ 2021-02-03 17:08

I have written these lines of code:

 mVideoView = (VideoView) findViewById(R.id.video_view);
    mVideoView.setOnClickListener(new OnClickListener() {
        @O         


        
11条回答
  •  灰色年华
    2021-02-03 17:26

    It is possible I have did this with onSetClickListener. And Here's a code for your help:

    mVideoView.setOnClickListener(new View.OnClickListener() {
        @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                //Here you put a condition for playing a video when you click on your video view.//
                if(my_video.isPressed())
                {   
                    my_video.start();
                } else {
                    Toast.makeText(getApplicationContext(), 
                        "Not able to run This Video!", 
                        Toast.LENGTH_LONG).show();
                }
            }
        });
    

提交回复
热议问题