title: Android - Videoview URL HttpURLConnection
body: <p>I have an activity(<em>activity A</em>) that can call another activity that load a video from a URL (Videoview). When i come back to the <em>activity A</em>, i can go to the activity B where i have a code that execute a request with HttpURLConnection. The problem is that if i go to <em>activity Video</em> and load the Videoview, the request in <em>activity B</em> return a empty response.</p>
  
  <p>If i change the <em>activity Video</em> and delete the Videoview  it work well.</p>
  
  <p><a href="http://i.stack.imgur.com/C2Go4.png" rel="nofollow">Image</a></p>
  
  <blockquote>
    <p>Activity Video:</p>
  </blockquote>
  
  <pre><code>    String urlVideo = getIntent().getStringExtra("URL_TRAILER");    
      Uri uri = Uri.parse(urlVideo);
      videoView = (VideoView)findViewById(R.id.myvideoview);      
      MediaController mc = new MediaController(this);
      mc.setAnchorView(videoView);
      mc.setMediaPlayer(videoView);
      videoView.setMediaController(mc);
      videoView.setVideoURI(uri);
      videoView.start();
  </code></pre>
  
  <blockquote>
    <p>HttpURLConnection</p>
  </blockquote>
  
  <pre><code>     HttpURLConnection conn = (HttpURLConnection) url.openConnection();
      conn.setDefaultUseCaches(false);
      conn.setUseCaches(false);
      conn.setReadTimeout(15000);
      conn.setConnectTimeout(15000);
      conn.setRequestMethod("POST");
      conn.setDoInput(true);
      conn.setDoOutput(true);
  
      int responseCode = conn.getResponseCode();
  
      if (responseCode == HttpsURLConnection.HTTP_OK) {
          String line;
          BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
          while ((line = br.readLine()) != null) {
              response += line;
          }
      } else {
          response = "";
  
      }
  </code></pre>