I am trying to make use of MediaPlayer
class for playing a video file. The problem is video is not getting displayed at all though I can hear the sound in the video
You can override the onSizeChanged()
function of the SurfaceView
class to get and set the size of the view.
protected void onSizeChanged (int w, int h, int oldw, int oldh)
When ever the screen size has changed, this class is called.
As a second alternative, you may be able to set the size by setting the layout parameters (unsure if this works with ScrollView):
@Override
public void surfaceCreated(SurfaceHolder holder) {
android.view.ViewGroup.LayoutParams lp = this.getLayoutParams();
lp.width = 1000; // required width
lp.height = 1000; // required height
this.setLayoutParams(lp);
}