Wednesday, September 8, 2010

Android Architecture and Android Components



Android Architecture
Applications
        Android will ship with a set of core applications including an email client, SMS program, calendar, maps, browser, contacts, and others. All applications are written using the Java programming language.
Application Framework
      The application Framework enable Android application to reuse and replace existent components.
The Framework include :

 ¨A rich and extensible set of Views that can be used to build an application, including lists, grids, text boxes, buttons, and even an embeddable web browser.

 ¨Content Providers that enable applications to access data from other applications (such as Contacts), or to share their own data.

 ¨A Resource Manager, providing access to non-code resources such as localized strings, graphics, and layout files.

 ¨Notification Manager that enables all applications to display custom alerts in the status bar.

 ¨An Activity Manager that manages the lifecycle of applications and provides a common navigation backstack.

Libraries
       Android system is based on set of C/C++ libraries used by various components of the android system.

Core libraries include :
¨System C library - a BSD-derived implementation of the standard C system library (libc), tuned for embedded Linux-based devices

¨Media Libraries - the libraries support playback and recording of many popular audio and video formats, as well as static image files, including MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG

¨Surface Manager - manages access to the display subsystem and seamlessly composites 2D and 3D graphic layers from multiple applications

¨LibWebCore - a modern web browser engine which powers both the Android browser and an embeddable web view.

¨SGL - the underlying 2D graphics engine.

¨3D libraries - an implementation based on OpenGL ES 1.0 APIs.

¨FreeType - bitmap and vector font rendering.

¨SQLlite - a powerful and lightweight relational database engine available to all applications.

Android Runtime
            Every Android  application run by using  Dalvik virtual machine(DVK). The Dalvik VM executes files in the Dalvik Executable (.dex) format which is optimized for minimal memory footprint.

Linux Kernel
          Android relies on Linux version 2.6 for core system services such as security,  memory management, process management, network stack, and driver model. The kernel also acts as an abstraction layer between the hardware and the rest of the software stack.


Components
Activity
--- An activity presents a visual user interface for one focused endeavor the user can undertake.
--- Each activity is independent of the others. Each one is implemented as a subclass of the Activity base class.
---Each activity is given a default window to draw in.
---The visual content of the window is provided by a hierarchy of views — objects derived from the base View class. A view hierarchy is placed within an activity's window by the Activity.setContentView() method.

Activity Life Cycle
Activities in the system are managed as an activity stack.
An activity has essentially  three states:
1.If an activity in the foreground of the screen (at the top of the stack), it is active or running.

2.If an activity has lost focus but is still visible (that is, a new non-full-sized or transparent activity has focus on top of your activity), it is paused.

3.If an activity is completely obscured by another activity, it is stopped.
       If an activity is paused or stopped, the system can drop the activity from memory by either asking it to finish, or simply killing its process.


There are three key loops you may be interested in monitoring within your activity:


The entire lifetime of an activity happens between the first call to onCreate(Bundle) through to a single final call to onDestroy().
The visible lifetime of an activity happens between a call to onStart() until a corresponding call to onStop().
The foreground lifetime of an activity happens between a call to onResume() until a corresponding call to onPause().

      Service
                                    A service is designed to operate independently of the screen, thus of activities. The best example is the music player that can works while moving from one screen to another.
        Intent

The intents are the goals of applications and are made effective by a new screen. An intent is made up of an action and data that are
 URI.

Examples of actions: MAIN, VIEW, EDIT, PICK.
If one wants to see a card about a person, an intent is defined. The action is VIEW and the data is the URI which enables access to this card.

IntentFilters describes how the action should apply.

IntentReceiver is an object that responds to external events. It can operate in the application or it can start an application.




Content Provider
                            Data stored by a computer program, in the form of files or SQLite databases are private and may not be used by other applications.But Content Provider may be used to share data among several applications. The interface ContentResolver is the interface that provides data to other objects.
          Notification
                             The class android.app.Notification defines how an event must be notified to user: displaying an icon, changing state of a led, vibration, or others. While the class android.app.NotificationManager sends the message in the form so defined.






No comments:

Post a Comment