title: android-black screen on displaying video by using VideoView
body: <p>this is my layout :</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical" &gt;
  
      &lt;FrameLayout
          android:id="@+id/frameLayout1"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:layout_gravity="center" &gt;
  
          &lt;VideoView
              android:id="@+id/geoloc_anim"
              android:layout_width="fill_parent"
              android:layout_height="match_parent"
              android:layout_gravity="top|center"
              android:visibility="visible" /&gt;
  
          &lt;FrameLayout
              android:id="@+id/placeholder"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent" &gt;
          &lt;/FrameLayout&gt;
      &lt;/FrameLayout&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>this is my activity code:</p>
  
  <pre><code>public class MainActivity extends ActionBarActivity implements OnPreparedListener {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          getSupportActionBar().hide();
          VideoView mVideoView = (VideoView) findViewById(R.id.videoview);
          Uri uri = Uri.parse("android.resource://" + getPackageName()+"/raw/lst2");
          mVideoView.setVideoURI(uri);
          mVideoView.requestFocus();
          mVideoView.setZOrderOnTop(true); 
          mVideoView.start();
  
      }
  
       @Override
        public void onPrepared(MediaPlayer mp) {
          mp.setOnInfoListener(new MediaPlayer.OnInfoListener() {
            @Override
            public boolean onInfo(MediaPlayer mp, int what, int extra) {
                View placeholder = (View) findViewById(R.id.placeholder);
              if (what == MediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START)  {
                // video started; hide the placeholder.
                placeholder.setVisibility(View.GONE);
                return true;
              }
              return false;
            }
          });
       }
  
      public void surfaceChanged(SurfaceHolder holder, int format, int width,int height) {
      }
  
      public void surfaceCreated(SurfaceHolder holder) {
      }
  
      public void surfaceDestroyed(SurfaceHolder holder) {
      }
  
  }
  </code></pre>
  
  <p>It works fine on android 4.2 but it doesn't work properly on android 2.3 . on android 2.3 , the first time it opens it works find but when close the app and open it again ,a black screen comes , something like this :
  <img src="https://i.stack.imgur.com/cGOQN.jpg" alt="enter image description here"></p>
  
  <p>and after one minute or so , it goes from a black screen to a  white screen but still nothing plays . </p>
  
  <p>Could you help me to solve this problem ?</p>