Android component is a simple piece of code that has well defined life cycle. These are the building blocks in Android
- Activities — Your application’s presentation layer. The UI of your application is built around one or more extensions of the Activity class.
Activities use Fragments and Views to layout and display information, and to respond to user actions. Compared to desktop development, Activities are equivalent to Forms.
- Services — The invisible workers of your application. Service components run without a UI, updating your data sources and Activities, triggering Notifications, and broadcasting Intents.
They’re used to perform long running tasks, or those that require no user interaction (such as network lookups or tasks that need to continue even when your application’s Activities aren’t active or visible.)
- Content Providers — Shareable persistent data storage. Content Providers manage and persist application data and typically interact with SQL databases. They’re also the preferred means to share data across application boundaries.
You can configure your application’s Content Providers to allow access from other applications, and you can access the Content Providers exposed by others.
Android devices include several native Content Providers that expose
useful databases such as the media store and contacts.
- Intents — A powerful inter application message-passing framework. Intents are used extensively throughout Android.
You can use Intents to start and stop Activities and Services, to broadcast messages system-wide or to an explicit Activity, Service, or Broadcast Receiver, or to request an action be performed on a particular piece of data.
- Broadcast Receivers — Intent listeners. Broadcast Receivers enable your application to listen for Intents that match the criteria you specify. Broadcast Receivers start your application to react to any received Intent, making them perfect for creating event-driven applications.
- Widgets — Visual application components that are typically added to the device home screen.
A special variation of a Broadcast Receiver, widgets enable you to create dynamic, interactive application components for users to embed on their home screens.
- Notifications — Notifications enable you to alert users to application events without stealing focus or interrupting their current Activity. They’re the preferred technique for getting a user’s attention when your application is not visible or active, particularly from within a Service or Broadcast Receiver.
For example, when a device receives a text message or an email, the messaging and Gmail applications use Notifications to alert you by flashing lights, playing sounds, displaying icons, and scrolling a text summary.
No comments:
Post a Comment