Playing A Video File On Button Click
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
Solution 1:
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.
Post a Comment for "Playing A Video File On Button Click"