Reference code: Camera.java