title: videoView doesn't show anything
body: <p>I need help with a <code>VideoView</code> problem with in Android. I've tried everything and even look up on stackoverflow questions, but no one has this exact problem.</p>
  
  <p><strong>Problem:</strong>
  The View supposed to show the picked video from gallery (this action is triggered by a button), but even though there's no error in the log and the uri is not null nothing is shown in the view. All of this is in a <code>Fragment</code> inside <code>ViewPager</code>. (If looking at the code below, the <code>Log.d("FragCamera", "I_REQUEST_VIDEO_PICK mediaUri : " + mediaUri);</code> is run and mediaUri is not <code>null</code>. So I don't know what else could be the problem.)</p>
  
  <p>Btw, I'm using Marshmallow real device to test this with usb debugging feature on and the app is set to JellyBean and above. And I don't think it's a permission problem as in the same page I have code using the same permission and it works fine.</p>
  
  <p><strong>Can anyone tell me why I can't get it to work?</strong> </p>
  
  <p>===================================</p>
  
  <p>This is my code. It's been stripped down to just the essential code to trigger this problem. <code>checkPermission()</code> is a method to check and request permission on runtime, and it works fine as the other code using this function and same permission works ok.</p>
  
  <p><strong>fragment_camera_action.xml</strong></p>
  
  <pre><code>&lt;VideoView
     android:id="@+id/preview_up_vid"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:layout_gravity="center"/&gt;
  </code></pre>
  
  <p><strong><code>fragment.java</code></strong></p>
  
  <pre><code>@Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
  
      View v = inflater.inflate(R.layout.fragment_camera_action, container, false);
  
      uploadedVid = (VideoView) v.findViewById(R.id.preview_up_vid);
      btn_getvid = (Button) v.findViewById(R.id.btn_getvid);
  
      MediaController mediaController = new MediaController(ctx);
      mediaController.setAnchorView(uploadedVid);
      uploadedVid.setMediaController(mediaController);
  
      btn_getvid.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              Log.d("FragCamera", "btn_getvid on click.");
  
              String[] permissions = new String[]{Manifest.permission.READ_EXTERNAL_STORAGE};
  
              if (checkMPermission(ctx, permissions, P_REQUEST_PICK_VIDEO)) {
                  pickVideo();
              }
          }
      });
  
      return v;
  }
  
  private void pickVideo() {
      Log.d("FragCamera", "pickVideo()");
      Intent pickPictureIntent = new Intent(Intent.ACTION_GET_CONTENT);
      pickPictureIntent.setType("video/*");
      this.startActivityForResult(Intent.createChooser(pickPictureIntent, "Select Video"), I_REQUEST_VIDEO_PICK);
  }
  
  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
      super.onActivityResult(requestCode, resultCode, data);
  
      Log.d("FragCamera", "onActivityResult()");
  
      Uri mediaUri;
  
      if (resultCode == RESULT_OK) {
  
          switch (requestCode) {
              case I_REQUEST_VIDEO_PICK:
                  uploadedVid.setVisibility(View.VISIBLE);
  
                  Log.d("FragCamera", "pickVideo() RESULT_OK");
  
                  if (data != null) {
                      mediaUri = data.getData();
                      Log.d("FragCamera", "I_REQUEST_VIDEO_PICK mediaUri : " + mediaUri);
  
                      uploadedVid.setVideoURI(mediaUri);
                      uploadedVid.setZOrderOnTop(true);
                      uploadedVid.start();
  
                  }
                  break;
              default:
                  break;
          }
  
      }
  }
  </code></pre>