@Override
 public void onConfigurationChanged(Configuration newConfig) {
   super.onConfigurationChanged(newConfig);
   Log.d("Orientation ", "" + newConfig.orientation);
   // Checks the orientation of the screen
   if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
     vid.pause();
     Intent i = new Intent(TrainingVideo.this, VideoFullscreen.class);
     i.putExtra("name", name);
     i.putExtra("StartAt", (int) time);
     Log.d("StartAt", "" + time);
     Log.d("name", name);
     onDestroy();
     startActivity(i);
   } else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
     Toast.makeText(this, "portrait", Toast.LENGTH_SHORT).show();
   }
 }