Android - Intent, Activity, Service, Broadcast Receiver, Content Provider

Adopt from :

Some of the core libraries are listed below:

  • System C library - a BSD-derived implementation of the standard C system library (libc), tuned for embedded Linux-based devices
  • Media Libraries - based on PacketVideo's OpenCORE; 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; the libraries use either hardware 3D acceleration (where available) or the included, highly optimized 3D software rasterizer
  • FreeType - bitmap and vector font rendering
  • SQLite - a powerful and lightweight relational database engine available to all applications

A central feature of Android is that one application can make use of elements of other applications (provided those applications permit it).

An activity presents a visual user interface for one focused endeavor the user can undertake.

A service doesn't have a visual user interface, but rather runs in the background for an indefinite period of time.

A broadcast receiver is a component that does nothing but receive and react to broadcast announcements.

A content provider makes a specific set of the application's data available to other applications.

Content providers are activated when they're targeted by a request from a ContentResolver. The other three components — activities, services, and broadcast receivers — are activated by asynchronous messages called intents. An intent is an

<a href="">Intent</a>

object that holds the content of the message. For activities and services, it names the action being requested and specifies the URI of the data to act on, among other things. For example, it might convey a request for an activity to present an image to the user or let the user edit some text. For broadcast receivers, the Intent object names the action being announced. For example, it might announce to interested parties that the camera button has been pressed.

A content provider is active only while it's responding to a request from a ContentResolver. And a broadcast receiver is active only while it's responding to a broadcast message. So there's no need to explicitly shut down these components.

Activities, on the other hand, provide the user interface. They're in a long-running conversation with the user and may remain active, even when idle, as long as the conversation continues. Similarly, services may also remain running for a long time. So Android has methods to shut down activities and services in an orderly way:

  • An activity can be shut down by calling its
    <code><a href="">finish()</a>

    method. One activity can shut down another activity (one it started with


    ) by calling

    <code><a href="">finishActivity()</a>


  • A service can be stopped by calling its
    <code><a href="">stopSelf()</a>

    method, or by calling

    <code><a href="">Context.stopService()</a>


The manifest is a structured XML file and is always named AndroidManifest.xml for all applications. It does a number of things in addition to declaring the application's components, such as naming any libraries the application needs to be linked against (besides the default Android library) and identifying any permissions the application expects to be granted.

本篇發表於 Android Apps Dev Competition 並標籤為 , 。將永久鏈結加入書籤。

Android - Intent, Activity, Service, Broadcast Receiver, Content Provider 有 2 則回應

  1. Domingo Stinar 說道:

    There's good info here. I did a search on Google, Keep up the good work mate!

  2. Michael 說道:

    I shouldn't be surprising so hard at that.


發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *