Skip to content Skip to sidebar Skip to footer

How To Play Video In Android After Button Click

I am trying to design simple code in android for play video after a button click but i am getting unknown problem. My present project files below. I am clueless right now. Please

Solution 1:

btnPlay.setOnClickListener(new View.OnClickListener() 
            {
                @Override
                public void onClick(View v) 
                {
                    try 
                    {
                        videoView.setVideoPath(videoPath);
                        videoView.setMediaController(new MediaController(Applicaion Context or YourActivity.this));
                        videoView.start();

                    }
                    catch (Exception e) 
                    {
                        e.printStackTrace();
                        System.out.println("Error in btnInfo Click -->"+e.toString());
                    }
                }
            });
            //BtnPlay

Post a Comment for "How To Play Video In Android After Button Click"