正确的Andr​​oid意向过滤器的配置与一个活动的文件类型关联?过滤器、文件类型、意向、正确

由网友(爷,将主宰你的世界)分享简介:这个问题已经被问[多次]过,但我还没有看到任何明确的答案,或code例子,实际工作。This question has been asked [numerous times] before, but I have not seen any definitive answers, or examples of code...

这个问题已经被问[多次]过,但我还没有看到任何明确的答案,或code例子,实际工作。

This question has been asked [numerous times] before, but I have not seen any definitive answers, or examples of code that actually works.

我想的活动与特定文件类型关联。

I would like to associate an Activity with a particular file type.

有关讨论,假定我希望我的活动要与PDF文件相关联。

For discussion, assume that I want my Activity to be associated with PDFs.

下面是我现在有。我已经尝试了许多不同的价值观和意图过滤器值的组合,但我还没有得到我的活动时,选择了PDF格式的开始。

Here is what I currently have. I have experimented with many different values and combinations of values in the intent-filter, but I have yet to get my Activity to start when a PDF is selected.


<activity name="com.mycompany.MyActivity">
    <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:mimeType="application/pdf" />
        <data android:pathPattern="*.pdf" />
        <data android:host="*" />
    </intent-filter>
</activity>

有谁知道如何真正使这项工作?

Does anyone know how to actually make this work?

推荐答案

您是否尝试过与简单的版本:

Have you tried with that simple version :

<activity name="com.mycompany.MyActivity">
    <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:mimeType="application/pdf" />
    </intent-filter>
</activity>
阅读全文

相关推荐

最新文章