其實方法就是通過 intent裏的 action參數來實現
構造intent時
1: Intent intent = new Intent(Intent.ACTION_EDIT, null);
2: startActivity(intent);
action參數是
ACTION_EDIT
這時就會查找所有在系統裏註冊過的 action name是 ACTION_EDIT 的activity
比如
在manifist 裏面註冊的自定義activity
20: <activity android:name=".AnotherActivity2" android:label="another2">
21: <intent-filter>
22: <action android:name="android.intent.action.EDIT" />
23: <category android:name="android.intent.category.DEFAULT" />
24: </intent-filter>
25: </activity>
如果註冊的activity裏面有幾個action name都是 ACTION_EDIT,則彈出列表讓用戶選擇
猜想對系統內建功能的調用也是類似的原理實現