title: VideoView doesn't show the video when switching tabs
body: <p>I have 2 tabs each containing videoView. But when I switch to the second tab the video plays the audio is working, but the video doesn't plays and the view is only black. This works fine in Android 2.1 + , but it does't in 1.6 Here is my code:</p>
  
  <p>TabActivity:</p>
  
  <pre><code>package com.example.tab;
  
  
  import android.app.TabActivity;
  import android.content.Intent;
  import android.os.Bundle;
  import android.widget.TabHost;
  
  public class main extends TabActivity {
      /** Called when the activity is first created. */
  
   private TabHost tabHost;
  
   public void onCreate( Bundle savedInstanceState){
   super.onCreate(savedInstanceState);
   tabHost = getTabHost();
  
      Intent intent1 = new Intent(this, Video1.class);
     Intent intent2 = new Intent(this, Video2.class);
  
  
       tabHost.addTab(tabHost.newTabSpec("Tab1")
          .setIndicator("Video1")
          .setContent(intent1.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP)));
  
       tabHost.addTab(tabHost.newTabSpec("Tab2")
      .setIndicator("Video2")
      .setContent(intent2.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP)));
  
   }
  }
  </code></pre>
  
  <p>Video1 activity:</p>
  
  <pre><code>/**
   * 
   */
  package com.example.tab;
  
  import android.app.Activity;
  
  import android.content.Intent;
  import android.content.res.Configuration;
  
  import android.net.Uri;
  import android.os.Bundle;
  import android.util.Log;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.view.SurfaceHolder;
  import android.view.View;
  
  import android.widget.MediaController;
  import android.widget.VideoView;
  
  /**
   * @author lyubomir.todorov
   * 
   */
  public class Video1 extends Activity implements SurfaceHolder.Callback {
  
   private String path = "http://xxx.xxx";
  
   private VideoView mVideoView;
  
   private SurfaceHolder holder;
   private static final int INSERT_ID = Menu.FIRST;
   private static final String TAG = "Tab";
  
   @Override
   public void onCreate(Bundle savedInstanceState) {
  
    super.onCreate(savedInstanceState);
  
    setContentView(R.layout.videoview1);
  
    mVideoView = (VideoView) findViewById(R.id.surface_view1);
  //  holder = mVideoView.getHolder();
  //  holder.addCallback(this);
  //  holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
  
   }
  
        public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    menu.add(0, INSERT_ID, 0, "FullScreen");
  
    return true;
   }
  
   public boolean onOptionsItemSelected(MenuItem item) {
    Log.d(TAG, "Player re-started after device configuration change");
  
    return true;
   }
  
   @Override
   public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
   }
  
   @Override
   protected void onResume() {
    // TODO Auto-generated method stub
    super.onResume();
  
    PlayVideo();
  
    Log.d(TAG, "onResume Video1");
  
   }
  
   protected void onPause() {
    super.onDestroy();
    Log.d(TAG, "onPause Video1");
    if (mVideoView != null) {
     mVideoView.stopPlayback();
     mVideoView.setVisibility(View.GONE);
     mVideoView=null;
     Log.d(TAG, "onPause1 Video1");
    }
  
   }
  
  
  
   public void surfaceDestroyed(SurfaceHolder surfaceholder) {
    holder.isCreating();
    Log.d(TAG, "video1 surfaceDestroyed called");
   }
  
   public void surfaceCreated(SurfaceHolder holder) {
    Log.d(TAG, "Current 1 surfaceCreated called");
    Log.d(TAG, Boolean.valueOf(holder.isCreating()).toString());
    // playVideo(extras.getInt(MEDIA));
  
   }
  
   public void PlayVideo() {
  
    mVideoView.setVideoPath(path);
    mVideoView.start();
    mVideoView.setMediaController(new MediaController(this));
    mVideoView.setVisibility(View.VISIBLE);
  
  
   }
  
   @Override
   public void surfaceChanged(SurfaceHolder holder, int format, int width,
     int height) {
    Log.d(TAG, Boolean.valueOf(holder.isCreating()).toString());
    // TODO Auto-generated method stub
    Log.d(TAG, "Current video surfaceChanged called");
  
   }
  
  }
  </code></pre>
  
  <p>videoview1.xml </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  
   android:orientation="vertical" android:layout_width="fill_parent"
   android:layout_height="fill_parent"&gt;
  
  
    &lt;VideoView android:id="@+id/surface_view1"
     android:layout_width="320dip" android:layout_height="240dip"
      /&gt; 
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Video2 activity:</p>
  
  <pre><code>/**
   * 
   */
  package com.example.tab;
  
  import android.app.Activity;
  
  import android.os.Bundle;
  import android.util.Log;
  
  import android.view.SurfaceHolder;
  import android.view.View;
  
  import android.widget.MediaController;
  import android.widget.VideoView;
  
  
  
  /**
   * @author lyubomir.todorov
   * 
   */
  public class Video2 extends Activity implements SurfaceHolder.Callback {
  
  
   private String path = "http://xxx.xxx";
  
   private VideoView mVideoView;
  
   private SurfaceHolder holder;
  
   private static final String TAG = "Tab";
  
  
  
   @Override
   public void onCreate(Bundle savedInstanceState) {
  
    super.onCreate(savedInstanceState);
  
    setContentView(R.layout.videoview2);
  
    mVideoView = (VideoView) findViewById(R.id.surface_view2);
  //  holder= mVideoView.getHolder();
  //  holder.addCallback(this);
  //  holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
  
  
  
  
  
   }
  
  
  
  
   @Override
   protected void onResume() {
    // TODO Auto-generated method stub
    super.onResume();
  
  
        PlayVideo();
  
  
  
  
    Log.d(TAG, "onResume Video1");
  
   }
  
   protected void onPause() {
    super.onPause();
    Log.d(TAG, "onPause Video2");
    if (mVideoView!=null){
     mVideoView.stopPlayback();
     mVideoView.setVisibility(View.GONE);
     Log.d(TAG, "onPause1 Video2");
    }
  
  
   }
  
   public void surfaceDestroyed(SurfaceHolder surfaceholder) {
    holder.isCreating();
    Log.d(TAG, "video1 surfaceDestroyed called");
   }
  
   public void surfaceCreated(SurfaceHolder holder) {
    Log.d(TAG, "Current 1 surfaceCreated called");
    Log.d(TAG, Boolean.valueOf(holder.isCreating()).toString());
  
  
  
   }
  
  
  
   public void PlayVideo() {
  
         mVideoView.setVisibility(View.VISIBLE);
  
  
         mVideoView.bringToFront();
         mVideoView.setVideoPath(path);
  
         mVideoView.start();
         mVideoView.setMediaController(new MediaController(this));
  
  
  
  }
  
  
   @Override
   public void surfaceChanged(SurfaceHolder holder, int format, int width,
     int height) {
    Log.d(TAG, Boolean.valueOf(holder.isCreating()).toString());
    // TODO Auto-generated method stub
    Log.d(TAG, "Current video surfaceChanged called");
  
   }
  
  }
  </code></pre>
  
  <p>videoview2.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
   android:orientation="vertical" android:layout_width="fill_parent"
   android:layout_height="fill_parent"&gt;
  
    &lt;VideoView android:id="@+id/surface_view2"
     android:layout_width="320dip" android:layout_height="240dip"
      /&gt; 
  
  &lt;/LinearLayout&gt;
  </code></pre>