就是让一个活动跳转到指定的网页,然后按下按键的时候会询问是打开网页还是打开thirdActivity活动
是想创建一个活动,注册,能让他响应Intent的隐式调用
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("http://www.baidu.com"));
startActivity(intent);
报错信息
Android resource linking failed
D:\AndroidProject\ActivityTest\app\build\intermediates\packaged_manifests\debug\AndroidManifest.xml:26: error: unexpected element <intent_filter> found in <manifest><application><activity>.
AndroidManifest文件
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.activitytest">
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.ActivityTest"
tools:targetApi="31">
<activity//这个是注册的活动
android:name=".ThirdActivity"
android:exported="false">
<intent_filter>//注册这个活动后就报错了,跟着书上来的,让这个活动能够响应http
<action android:name="android.intent.action.VIEW"/>
<categroy android:name="android.intent.category.DEFAULT"/>
<data android:scheme="http"/>
</intent_filter>
</activity>
<activity
android:name=".SecondActivity"
android:label="This is SecondActivity"
android:exported="false">
<intent-filter>
<action android:name="com.example.activitytest.ACTION_START" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="com.example.activitytest.MY_CATEGORY" />
</intent-filter>
</activity>
<activity
android:name=".FirstActivity"
android:exported="true"
android:label="This is FirstActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>