Intent七大属性之总结
 
參考《瘋狂android講義》第5章
 
1、Intent 用于封裝程序的”調用意圖“,不管想啟動一個Acitivity、Service還是BroadcastReceiver,Android均使用統一的Intent對象來封裝這種”啟動意圖“。很明顯使用Intent提供了一致的編程模型。
 
2、Intent還有一個好處,如果應用程序只是想啟動具有某種特征的組件,并不想和某個具體的組件耦合,則可以通過在intent-filter中配置相應的屬性進行處理,與stucts2中的MVC框架思路類似。
 
3、Intent對象大致包括7大屬性:ComponentName ?Action ?Category ?Data ?Type ?Extra ?Flag。
 
4、7大屬性中,前面5個均用于指定本intent用于啟動哪個組件,ComponentName直接指定組件的名稱,后4個指定類型,只要符合此類型條件的組件均可響應此Intnet。前者稱為顯式Intnet,后者稱為隱式intent。前者一般用于啟動自身程序的其它組件,后者一用于啟動其它程序的組件(包括系統組件)。
- Explicit intents?designate the target component by its name (the?component name field, mentioned earlier, has a value set). Since component names would generally not be known to developers of other applications, explicit intents are typically used for application-internal messages — such as an activity startinga subordinate service or launching a sister activity.
-  Implicit intents?do not name a target (the field for the component name is blank). Implicit intents are often used to activate componentsin other applications. 
 
說見Intent七大屬性之一~~~七
總結
以上是生活随笔為你收集整理的Intent七大属性之总结的全部內容,希望文章能夠幫你解決所遇到的問題。
 
                            
                        - 上一篇: 使用SQLiteHelper创建数据库并
- 下一篇: Intent七在属性之一:Compone
