Android的四種重要組件

Activity:html

          An Activity  is an application component that provides a screen with which users can interact in order to do something, such as dial the phone, take a photo, send an email, or view a map. Each activity is given a window in which to draw its user interface. The window typically fills the screen, but may be smaller than the screen and float on top of other windows.java

Services:android

          A Service is an application component that can perform long-running operations in the background and does not provide a user interface. Another application component can start a service and it will continue to run in the background even if the user switches to another application. Additionally, a component can bind to a service to interact with it and even perform interprocess communication (IPC). For example, a service might handle network transactions, play music, perform file I/O, or interact with a content provider, all from the background.windows

Content Providers:app

           Content providers manage access to a structured set of data. They encapsulate the data, and provide mechanisms for defining data security. Content providers are the standard interface that connects data in one process with code running in another process.ide

BroadCast Recevicer:spa

 extends Object
code

java.lang.Object
   ↳ android.content.BroadcastReceiver
Known Direct Subclasses    

AppWidgetProvider       ,       DeviceAdminReceiver            component

AppWidgetProvider A convenience class to aid in implementing an AppWidget provider. 
DeviceAdminReceiver Base class for implementing a device administration component. 

BroadCast Recevicer:接受一種或者多種Intent做觸發事件,接受相關消息,作一些簡單處理,轉換成一條Notification,統一了Android的事件廣播模型。可使用BroadcastReceiver來讓應用對外一個外部的事件做出響應。Broadcast Receiver經過NotificationManager來通知用戶這些事情發生了,BroadcastReceiver註冊的有兩種方式,一種是能夠在AndroidManifest.xml中註冊,另外一種能夠在運行時的代碼中使用Context.registerReceiver()進行註冊。用戶還能夠經過Context.sendBroadcast()將他們本身的intent broadcasts廣播給其餘的應用程序。orm

相關文章
相關標籤/搜索