title: videoview video disappear after orientation change
body: <p>I am new with android and i am making a simple application where i will get a video from local device and play it in a videoview in my layout. Playing the video works fine but when i change orientation from portrait to landscape, the video disappear. I believe i need to save the state of the activity. Here is my code.</p>
  
  <pre><code>public class MainActivity extends AppCompatActivity {
  private int position = 0;
  private VideoView vidView;
  private static int RESULT_LOAD_VIDEO = 1;
  String vidDecodableString;
  
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      Button buttonLoadVideo = (Button)findViewById(R.id.buttonLoadVideo);
      this.vidView = (VideoView)findViewById(R.id.myVideo);
  
      buttonLoadVideo.setOnClickListener(new Button.OnClickListener() {
          @Override
          public void onClick(View v) {
              Intent galleryIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Video.Media.EXTERNAL_CONTENT_URI);
              startActivityForResult(galleryIntent, RESULT_LOAD_VIDEO);
          }
      });
  }
  @Override
  protected void onActivityResult (int requestCode, int resultCode, Intent data) {
      try {
          if (requestCode == RESULT_LOAD_VIDEO &amp;&amp; resultCode == RESULT_OK &amp;&amp; null != data){
              Uri selectedVideo = data.getData();
  
              String[] filePathColumn = { MediaStore.Video.Media.DATA };
              Cursor cursor = getContentResolver().query(selectedVideo, filePathColumn, null, null, null);
              cursor.moveToFirst();
              int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
              vidDecodableString = cursor.getString(columnIndex);
  
              //URI
              Uri vidUri = Uri.parse(vidDecodableString);
              vidView.setVideoURI(vidUri);
  
              MediaController vidControl = new MediaController(this);
              vidControl.setAnchorView(vidView);
              vidView.setMediaController(vidControl);
              vidView.start();
  
          } else {
              Toast.makeText(this, "Please select video to play.", Toast.LENGTH_LONG).show();
          }
      } catch (Exception e) {
          Toast.makeText(this, "Something went wrong.", Toast.LENGTH_SHORT).show();
      }
  }
  
  @Override
  public void onSaveInstanceState(Bundle savedInstanceState) {
      super.onSaveInstanceState(savedInstanceState);
      savedInstanceState.putInt("Position", vidView.getCurrentPosition());
      vidView.pause();
  }
  
  @Override
  public void onRestoreInstanceState(Bundle savedInstanceState) {
      super.onRestoreInstanceState(savedInstanceState);
      position = savedInstanceState.getInt("Position");
      vidView.seekTo(position);
  }
  </code></pre>
  
  <p>}</p>
  
  <p>After i run the code, the selecting and playing of the video works but when i change the orientation, the video loaded disappear. Where am i doing wrong. Please advice.</p>