Adding null checks,fixing error exceptions and formatting CameraFragment.java