MediaPlayer.setDisplay() in android
<p>I am creating a video player using MediaPlayer class in android. I set a SurfaceHolder in MediaPlayer.setDisplay(), it shows video successfully but when this activity resumed again then no video is diplayed. So what is wrong ??</p>

<p><strong>The Code is:</strong></p>

<pre><code>public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        setContentView(R.layout.main);
        player = new MediaPlayer();
        surface = (SurfaceView)findViewById(R.id.surface);
        surface.setOnClickListener(new OnClickListener() 
        { 
            @Override
            public void onClick(View v) 
            {
                VideoDemo.this.startActivity(new Intent(VideoDemo.this, AnotherActivity.class));//Video not displayed when return from this activity by pressing back button
            }
        });
        holder = surface.getHolder();
        holder.addCallback(this);
        holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
        try  
        {
            String songName = Environment.getExternalStorageDirectory().toString()+File.separator+"1.mp4";
            player.setDataSource(songName);
            player.prepare();
            player.start();

        }
        catch (Exception e) 
        {
            e.printStackTrace();
        }

    }
    @Override
    public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) 
    { 
        player.setDisplay(holder);      
    }
    @Override
    public void surfaceCreated(SurfaceHolder holder) 
    {
        Log.d(TAG, "surfaceCreated() is called ************ holder.getSurface() = "+holder.getSurface());
    }
    @Override
    public void surfaceDestroyed(SurfaceHolder holder) 
    {
        Log.d(TAG, "surfaceDestroyed() is called ************");
    }
</code></pre>
