01.png
Intent傳遞物件主要有兩種方法
一種是用Serializable
它是用在有Treade時可以控制物件避免被同時使用
另一種是用Parcelable

RX1226 發表在 痞客邦 留言(0) 人氣()

01.png
intent傳遞參數是很常用的方法
一般的常數和物件都直接用putExtra(鍵值, 傳遞的數值)
這樣的形式來傳遞
接收方就使用getIntent()來取得該Intent

RX1226 發表在 痞客邦 留言(0) 人氣()

01.png
這篇要介紹Intent和Intent filter是如何配對的
介紹如下
 
當系統收到implicit intent要啟動activity時
android系統會根據下列3個層面來找出適合的activity
action
data(URI and data type)
category

RX1226 發表在 痞客邦 留言(0) 人氣()

01.png
Intent Filter是在mainfest內設定的
介紹如下
 
Explicit intent在使用時不管intent filter的宣告
而intent filter的使用是在mainfest內用<intent-filter>使用
<action>
在 name 屬性中,宣告接受的intent action。
必須是動作的常數字串,不能是class內的常數。
ex: <action android:name="string" />
<data>
使用一或多項屬性來宣告接受的資料類型。
ex: <data android:scheme="string"
      android:host="string"
      android:port="string"
      android:path="string"
      android:pathPattern="string"
      android:pathPrefix="string"
      android:mimeType="string" />
<category>
在 name 屬性中,宣告接受的intent category。
必須是動作的常數字串,不能是class內的常數。
ex: <category android:name="string" />

RX1226 發表在 痞客邦 留言(0) 人氣()

01.png
App Chooser就是在啟動Activity有多筆以上符合的時候
會跳出的選擇清單
介紹如下
 

RX1226 發表在 痞客邦 留言(0) 人氣()

01.png
Intent主要分explicit intent和implicit兩種
這篇介紹建立方式
 
1. 官網https://developer.android.com/guide/components/intents-filters.html#Building

RX1226 發表在 痞客邦 留言(0) 人氣()

01.png
Intent的組成主要有Component name, Action, Date, Category, Extras和Flags
一些細節可以到官網https://developer.android.com/reference/android/content/Intent.html
Intent的成員介紹如下

RX1226 發表在 痞客邦 留言(0) 人氣()

01.png
Intent是一個messaging object,
用來和app component溝通
主要有3種用法
a. To start an activity: 啟動activity
b. To start a service: 啟動service
c. To deliver a broadcast: 傳送廣播

RX1226 發表在 痞客邦 留言(0) 人氣()

1
Blog Stats
⚠️

成人內容提醒

本部落格內容僅限年滿十八歲者瀏覽。
若您未滿十八歲,請立即離開。

已滿十八歲者,亦請勿將內容提供給未成年人士。