Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6080389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:03:20+00:00 2026-05-23T11:03:20+00:00

Whenever I’ll put this codes line into the button onClick event then it will

  • 0

Whenever I’ll put this codes line into the button onClick event then it will gave me error ho to resolve it. The Error on a line of “mc = new MediaController(this); ” and error is :
(“The constructor MediaController(new View.OnClickListener(){}) is undefined”)

public class TrialVideoActivity extends Activity  {

 public MediaController mc;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
  setContentView(R.layout.main);

final Button play =(Button)findViewById(R.id.play);
  play.setOnClickListener(new OnClickListener(){
      public void onClick(View V){

  VideoView vd = (VideoView) findViewById(R.id.surface_view);
  Uri uri = Uri.parse("android.resource://" + getPackageName() + "/"+R.raw.lic);
  mc = new MediaController(this);
  vd.setMediaController(mc);
  vd.requestFocus();
  vd.setVideoURI(uri);
  vd.start();





      }
  });}

Whenever I played the video file directly then it will working perfectly but whenever I put it into the button click it will show the above error.
plz help me.

And one more thing how to increasing quality of video nad the buffering b’coz when the video is runing sound of the video is ok but the video going behind the sound…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T11:03:21+00:00Added an answer on May 23, 2026 at 11:03 am
     mc = new MediaController(this);
    

    on this line you are passing Context of Button click, I think you should pass here your Activity Context.
    For this you should declare a Context

    Private Context context; inside Class and then inside onCreat() you shiuld initialize it by

    context = this;
    

    and use

      mc = new MediaController(context);      // this is using context of Activity Class. 
    

    this is better way to resolve Context problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Whenever I try to add this line it crashes my app. Am I not
Whenever I introduce the array, i get this error. I tried different array types...but
Whenever I run any jython program in Eclipse, I got the following error in
Whenever I perform select statements in the command line tool it doesn't use all
Whenever I do a: $this->Job->find('all', array( 'group' => array('Job.some_field'), 'recursive' => -1 )); I
Whenever I try to Install my application on android emulator it gives error: no
Whenever I open IDEA it spends some time in indexing and then shows lots
Whenever I try to build an application with Interix's GCC on Windows, this is
Whenever I POST a form, I display error messages. However, the way I add
Whenever I call a clojure function that gets a users' console input using (read-line)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.