@Override public void onClick(View v) { int direction = mVideoCallManager.getCameraDirection(); // Switch the camera front/back/off // The state machine is as follows // front --> back --> stop preview --> front... switch (direction) { case CAMERA_UNKNOWN: switchCamera(mFrontCameraId); break; case Camera.CameraInfo.CAMERA_FACING_FRONT: switchCamera(mBackCameraId); break; case Camera.CameraInfo.CAMERA_FACING_BACK: switchCamera(CAMERA_UNKNOWN); break; } }