UML Class Diagram Example
This example is implementation level class diagram which shows some classes using Android Camera API (Android 3.1 Platform, API Level 12). Details of the API could be found at Android hardware Camera class. Example implementation that we follow is described in Using Android Camera API.
CameraDemo extends Android's Activity. An activity is a single, focused thing that the user can do with Android. Activity usually interacts with user, and the Activity class takes care of creating a window in which we can place our user interface. CameraDemo activity will create a Preview object and will hold reference to. Preview holds back reference to the activity as its Context. The Preview object will create a Camera object and return it to the CameraDemo activity.
The Camera class is Android hardware class used to get/create objects of the Camera class, set image capture settings, start or stop preview, take pictures, etc. Camera class is not thread-safe, and should be used from a single event thread. This class is a client for the Camera service, which manages the actual camera hardware.
Android Camera demo implementation classes UML class diagram example.
We will need to register some callback methods to be called by the Camera asynchronously after takePicture method was called and the shutter opened, picture is taken, and when picture data is ready.
SurfaceHolder is an interface implemented by objects holding a display surface. It allows us to control the surface size and format, edit the pixels in the surface, monitor changes to the surface, get direct access to the surface object, etc. SurfaceHolder.Callback interface allows to receive information about changes to the surface.