Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/197.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 单击.mp3链接时打开我的Android应用程序_Java_Android_Intentfilter - Fatal编程技术网

Java 单击.mp3链接时打开我的Android应用程序

Java 单击.mp3链接时打开我的Android应用程序,java,android,intentfilter,Java,Android,Intentfilter,我正在尝试创建一个活动,当我在浏览器中单击.mp3链接时,该活动将打开 以下是我的意向过滤器: <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category andro

我正在尝试创建一个活动,当我在浏览器中单击.mp3链接时,该活动将打开

以下是我的意向过滤器:

<intent-filter>
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />

            <data android:scheme="file" />
            <data android:scheme="http" />
            <data android:host="*" />
            <data android:mimeType="application/mp3" />
        </intent-filter>


没有任何效果。

作为替代方案,您也可以尝试以下方法:

<intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:scheme="content" />
    <data android:scheme="file" />
    <data android:pathPattern=".*mp3" />
    <data android:mimeType="audio/*" />
</intent-filter>


它不起作用,因为我放了:
在意图过滤器的内部。现在我的活动中只有多个意图过滤器

<intent-filter>
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.BROWSABLE" />
            <category android:name="android.intent.category.DEFAULT" />

            <data
                android:host="*"
                android:pathPattern=".*.mp3"
                android:scheme="http" />
        </intent-filter>