Hi,
i have written the following code to display a video file on a surface view. the application stops unexpectedly when i try to run it in the emulator. I have the video file placed in the res/raw folder . Can someone tell me where i am going wrong?
public class CustomView extends Activity implements SurfaceHolder.Callback{
MediaPlayer mp;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.main);
final SurfaceView mediaSurface = (SurfaceView) findViewById(R.id.MediaSurface);
SurfaceHolder h = mediaSurface.getHolder();
h.addCallback(this);
mp = MediaPlayer.create(CustomView.this, R.raw.cdec);
mp.setDisplay(h);
}
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width,
int height) {
// TODO Auto-generated method stub
}
@Override
public void surfaceCreated(SurfaceHolder holder) {
// TODO Auto-generated method stub
mp.start();
}
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
// TODO Auto-generated method stub
}
}


