Application Development for Android
Here we provide some examples of UML diagrams of different types, all related to Android SDKs and application development.
Android Camera Implementation Classes
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.
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.
Android Application Deployment
This is an example of UML deployment diagram which shows deployment of an application to Android.
Android is a software stack for mobile devices that includes an operating system, middleware and key applications. Android relies on Linux OS for core system services such as security, memory management, process management, network stack, and driver model. The Linux kernel also acts as an abstraction layer between the hardware and the rest of the software stack.
Android applications are written in Java. Android SDK tools compile and package the code along with any required data and resource files into Android application archive file having .apk suffix. The .apk file represents one Android application to be deployed to the Android-enabled mobile devices.
Example of application deployment to Android.
Android applications are composed of one or more application components (activities, services, content providers, and broadcast receivers). Each component performs a different role in the overall application behavior, and each one can be activated individually (even by other applications).
The manifest (deployment specification) file AndroidManifest.xml describes application requirements, such as the minimum version of Android required and any supported hardware configurations, and it also declares all components in the application.
With Android API Level 8 or later, application could be installed on the external storage (for example, on the SD card). This is an optional feature that could be requested for the specific application using a manifest attribute. By default, application is installed on the internal storage of the mobile device and cannot be moved to the external storage.