@SuppressLint("NewApi")
 private void openCamera() {
   if (mCamera == null) {
     Log.d("", "Open new Camera Object");
     if (android.os.Build.VERSION.SDK_INT >= 9) {
       try {
         Log.d("", "Trying to open camera with id = " + VinteractApplication.mCameraIDToOpen);
         mCamera = Camera.open(VinteractApplication.mCameraIDToOpen);
       } catch (RuntimeException RE) {
         RE.printStackTrace();
         finishWithCameraRealease();
       }
     } else {
       mCamera = Camera.open();
     }
     if (mCamera == null) {
       Log.e("", "Error: Sorry your device does not have unused Camera.");
       finishWithCameraRealease();
       return;
     }
     if (customVideoView != null) {
       Log.d("", "Set preview with new camera object onPause");
       customVideoView.setCamera(mCamera);
       customVideoView.setPreviewCallback(this);
     }
   }
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow()
        .setFlags(
            WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

    setContentView(R.layout.activity_vinteract_full);

    openCamera();
    FrameLayout framelayout = (FrameLayout) findViewById(R.id.cameraPreview);
    customVideoView = new VinteractVideoPreview(this, mCamera);
    customVideoView.setPreviewCallback(this);
    framelayout.addView(customVideoView);
    framelayout.setOnTouchListener(this);

    vv = (VinteractVideoView) findViewById(R.id.vinteractVideoView);
    vv.setOnErrorListener(this);
    vv.setOnPreparedListener(this);
    readyToPlay = false;
    currentPosition = 0;

    stopMedia(null);

    Uri uri = Uri.parse(path);
    MediaController controller = new MediaController(this);
    this.vv.setMediaController(controller);
    this.vv.setOnPreparedListener(
        new OnPreparedListener() {
          @Override
          public void onPrepared(MediaPlayer mp) {
            mp.seekTo(currentPosition);
            mp.start();
          }
        });
    setScreenDimention();
    vv.setVideoURI(uri);
    vv.requestFocus();

    mBottomBar = (RelativeLayout) findViewById(R.id.bottom_bar);
    mBottomBar.setVisibility(View.VISIBLE);

    mRunnableforBottomBar =
        new Runnable() {
          @Override
          public void run() {
            mBottomBar.setVisibility(View.INVISIBLE);
          }
        };

    backButton = (ImageButton) findViewById(R.id.back_button);
    backButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            showExitAlert("Want to Stop ?");
          }
        });

    flip_camera = (ImageButton) findViewById(R.id.flip_camera);
    flip_camera.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            asyncSwitchCamera();
          }
        });

    settingsButton = (ImageButton) findViewById(R.id.settings_button);
    settingsButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Toast.makeText(
                    VinteractDualScreenActivity.this,
                    "Settings not implemented yet",
                    Toast.LENGTH_SHORT)
                .show();
          }
        });

    hideBottomBarLater();
  }