今天使用隐式Intention启动Activity不成功。看了官方的文档介绍才发现 少了
<category android:name="android.intent.category.DEFAULT" />
正确的方式:
<activity android:name=".WebDemo" android:label="@string/title_activity_web_demo" android:theme="@style/AppTheme.NoActionBar" > <intent-filter> <action android:name="android.intent.action_WEBDEMO" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity>
Note: In order to receive implicit intents, you must include theCATEGORY_DEFAULT
category in the intent filter. The methodsstartActivity()
andstartActivityForResult()
treat all intentsas if they declared the CATEGORY_DEFAULT
category.If you do not declare it in your intent filter, no implicit intents will resolve toyour activity.