title: Android playing video fullscreen in a new activity on button click
body: <p>I'm streaming a video in my app, and it works fine. 
  The problem is that when I try to make it full screen (in a new activity or otherwise), the screen is blank.</p>
  
  <p>I have tried doing it without starting a new activity, as suggested <a href="https://stackoverflow.com/questions/1574654/playback-video-full-screen">here</a>:</p>
  
  <p>In my main activity:</p>
  
  <pre><code>butFullScreen.setOnClickListener(new View.OnClickListener() {
          public void onClick(View v) {
              if(isFS)
                  setContentView(R.layout.activity_full_screen_video);
              else
                  setContentView(R.layout.activity_starting_point);
          }
  });
  </code></pre>
  
  <p>I've also tried opening it in a new activity (which I prefer):</p>
  
  <pre><code>butFullScreen.setOnClickListener(new View.OnClickListener() {
          public void onClick(View v) {
              //Start fs intent
              Intent myIntent = new Intent(StartingPoint.this, FullScreenVideo.class);
              StartingPoint.this.startActivity(myIntent);
          }
  });
  </code></pre>
  
  <p>Where FullScreenVideo:</p>
  
  <pre><code>public class FullScreenVideo extends StartingPoint{
  
      //private VideoView vv;
  
      public FullScreenVideo(){
      }
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          getSupportActionBar().hide();
          setContentView(R.layout.activity_full_screen_video);
          vv.start();
      }
  }
  </code></pre>
  
  <p>And activity_full_screen_video:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:layout_alignParentRight="true"
      android:layout_alignParentLeft="true"
      android:layout_alignParentTop="true"
      android:layout_alignParentBottom="true"
      android:background="#ff000000"&gt;
  
      &lt;VideoView
          android:id="@+id/vv"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:layout_centerVertical="true"
          android:layout_centerHorizontal="true" /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>And in my manifest:</p>
  
  <pre><code>&lt;activity
              android:name=".FullScreenVideo"
              android:label="@string/app_name"
              android:screenOrientation="landscape"
              android:configChanges="keyboardHidden|orientation|screenSize" /&gt;
  </code></pre>
  
  <p>It doesn't show any error or crash, just a blank screen. Also, I'm not using the media controller, so answers without that would be appreciated :)</p>
  
  <p>Edit::</p>
  
  <p>StartingPoint:</p>
  
  <pre><code>public class PlayVid extends ActionBarActivity {
  
  int play = -1;
  int k;
  int m = 0;
  int where;
  int pausePressed = 0;
  int displaySub = 0;
  String curSub = " ";
  ArrayList&lt;Stime&gt; timeArray = new ArrayList&lt;Stime&gt;();
  
  Button but;
  Button butStop;
  Button butSub;
  Button butFS;
  TextView subs, log;
  VideoView vv;
  ProgressBar pBar;
  
  int isFS, space;
  
  String srt = "00:00:01,478 --&gt; 00:00:04,020\n" +
          "VimeoSrtPlayer Example\n" +
          "\n" +
          "00:00:05,045 --&gt; 00:00:09,545\n" +
          "Support for &lt;i&gt;italic&lt;/i&gt; font\n" +
          "\n" +
          "00:00:09,378 --&gt; 00:00:13,745\n" +
          "Support for &lt;b&gt;bold&lt;/b&gt; font\n" +
          "\n" +
          "00:00:14,812 --&gt; 00:00:16,144\n" +
          "Multi\n" +
          "Line\n" +
          "Support ;)\n" +
          "\n" +
          "00:00:18,211 --&gt; 00:00:21,211\n" +
          "Fonts: DejaVu\n" +
          "http://dejavu-fonts.org\n" +
          "\n" +
          "00:00:22,278 --&gt; 00:00:25,678 \n" +
          "END OF EXAMPLE FILE";
  
  subParse sp = new subParse(this, srt);
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
      setProgressBarIndeterminateVisibility(true);
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_starting_point);
  
      pBar = (ProgressBar) findViewById(R.id.progressBar);
      subs = (TextView) findViewById(R.id.subtitleBox);
      log = (TextView) findViewById(R.id.logBox);
      but = (Button) findViewById(R.id.but);
      butStop = (Button) findViewById(R.id.butStop);
      butSub = (Button) findViewById(R.id.butSub);
      butFS = (Button) findViewById(R.id.butFS);
  
      vv = (VideoView) findViewById(R.id.vv);
      vv.setVideoPath("@string/video_link");
  
      String[] lines = {" \n", " \n"};
      sp.parseSub(srt);
  
      subs.setText("--Click Play to start--\n--Click on SUB to view subtitles--");
      final String[] sub2 = log.getText().toString().split(System.getProperty("line.separator"));
      final subHelper sob = new subHelper(this, sub2);
      final onPauseHelper oph = new onPauseHelper();
      final fsHelper fsh = new fsHelper(this);
      final playHelper ph = new playHelper();
      timeArray.add(new Stime(vv.getDuration(), 0));
  
      but.setOnClickListener(new View.OnClickListener() {
          long startTime = 0, trop = 0;
          int space = 0;
  
          public void onClick(View v) {
              subs.setText(curSub);
              fsh.space = space;
              if (fsh.isFS == 1) {
                  //Chill
              } else if (play == 0 || play == -1) {
                  vv.start();
                  pBar.setVisibility(View.VISIBLE);
                  if (vv.isPlaying()) {
                      startTime = Calendar.getInstance().getTimeInMillis();
                      pBar.setVisibility(View.INVISIBLE);
                      //Play
                      if (play == -1) {
                          sob.setDefaults();
                      }
                      oph.putAttr(3, startTime);
                      but.setText("||");
                      but.setTextColor(Color.parseColor("#ffaaaaaa"));
  
                      if (k &lt; m) {
                          play = 1;
                          final Handler handler = new Handler();
                          final Runnable run = new Runnable() {
                              @Override
                              public void run() {
                                  if (k &lt; m &amp;&amp; play == 1 &amp;&amp; fsh.isFS == 0) {
                                      if (pausePressed == 0) {
                                          oph.putAttr(0, Calendar.getInstance().getTimeInMillis());
                                      } else {
                                          oph.putAttr(0, startTime);
                                          where--;
                                      }
                                      //oph.nextPressed=Calendar.getInstance().getTimeInMillis();
                                      if (space == 0) {
                                          space = 1;
                                          fsh.space = space;
                                          play = sob.subPlay(startTime, 0);
                                          fsh.play = play;
                                          trop = (timeArray.get(k).getTime(1) - timeArray.get(k).getTime(0));
                                          handler.postDelayed(this, Math.abs(trop &gt; 0 ? (trop - oph.done) : 0));
                                      } else if (space == 1) {
                                          space = 0;
                                          fsh.space = space;
                                          play = sob.subPlay(startTime, 1);
                                          fsh.play = play;
                                          trop = timeArray.get(k + 1).getTime(0) - timeArray.get(k).getTime(1);
                                          handler.postDelayed(this, Math.abs(trop &gt; 0 ? (trop - oph.done) : 0));
                                          k++;
                                      }
                                      oph.putAttr(1, Calendar.getInstance().getTimeInMillis());
                                      pausePressed = 0;
                                      sob.pp = 0;
                                      oph.reset();
                                      oph.done = 0;
                                  } else if (k &gt;= m &amp;&amp; fsh.isFS == 0) {
                                      final Runnable run = new Runnable() {
                                          @Override
                                          public void run() {
                                              but.setText("↻");
                                              but.setTextColor(Color.parseColor("#ffcdcdcd"));
                                              subs.setText("Play Again?");
                                              handler.removeCallbacks(this);
                                              play = -1;
                                              fsh.play = play;
                                              //ph.saveState(play,0,k,0,curSub,displaySub);
                                              curSub = " ";
                                          }
                                      };
                                      while (vv.isPlaying()) {
                                      }
                                      handler.postDelayed(run, 0);
                                  }
                              }
                          };
                          if (k == 0)
                              handler.postDelayed(run, (timeArray.get(0).getTime(0)));
                          else if (k &lt; m) handler.postDelayed(run, 0);
                      }
                  }
  
              } else if (play == 1) {
                  //Pause
                  vv.pause();
                  oph.reset();
                  oph.putAttr(2, Calendar.getInstance().getTimeInMillis());
                  subs.setText(curSub);
                  pausePressed = 1;
                  oph.done = +oph.getProg();
                  sob.pp++;
                  but.setText("▶");
                  but.setTextColor(Color.parseColor("#ffcdcdcd"));
                  if (k &lt; m) {
                      if (space == 0) {
                          space = 1;
                          fsh.space = space;
                      } else if (space == 1) {
                          space = 0;
                          fsh.space = space;
                      }
                      play = sob.subPause(oph.getAttr(2));
                      fsh.play = play;
                  }
              }
          }
      });
  
      butStop.setOnClickListener(new View.OnClickListener() {
          public void onClick(View v) {
              vv.stopPlayback();
              sob.setDefaults();
              play = 0;
              fsh.play = play;
              but.setText("▶");
              subs.setText("--Click Play to start--");
              curSub = " ";
          }
      });
  
      butSub.setOnClickListener(new View.OnClickListener() {
          public void onClick(View v) {
              if (displaySub == 0) {
                  displaySub = 1;
                  subs.setText(curSub);
                  butSub.setTextColor(Color.parseColor("#ffaaaaaa"));
              } else if (displaySub == 1) {
                  displaySub = 0;
                  subs.setText(" ");
                  butSub.setTextColor(Color.parseColor("#ffcdcdcd"));
              }
          }
      });
  
      butFS.setOnClickListener(new View.OnClickListener() {
          public void onClick(View v) {
              //Start fs intent
              Intent myIntent = new Intent(PlayVid.this, TwoFullScreenVideo.class);
              PlayVid.this.startActivity(myIntent);
          }
      });
  }
  </code></pre>
  
  <p>}</p>
  
  <p>FullScreenVideo:</p>
  
  <pre><code>public class FullScreenVideo extends StartingPoint {
  
      fsHelper fsh;
      onPauseHelper oph;
      subHelper sob;
      playHelper ph;
  
      protected PlayVid context;
  
      TextView subs;
      Button but, butStop, butSub, butFS;
  
      public FullScreenVideo(){}
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          getSupportActionBar().hide();
          setContentView(R.layout.activity_full_screen_video);
  
          subs = (TextView) findViewById(R.id.subtitleBox);
          but = (Button) findViewById(R.id.but);
          butStop = (Button) findViewById(R.id.butStop);
          butSub = (Button) findViewById(R.id.butSub);
          butFS = (Button) findViewById(R.id.butFS);
          vv = (VideoView) findViewById(R.id.vv);
  
          butFS.setOnClickListener(new View.OnClickListener() {
              public void onClick(View v) {
                  FullScreenVideo.this.finish();
              }
          });
  
      }
  }
  </code></pre>