gpt4 book ai didi

java - 针对非启动器 Activity 的 Android Intent 过滤器

转载 作者:行者123 更新时间:2023-12-01 08:51:49 25 4
gpt4 key购买 nike

我正在尝试为我的 Activity (非启动器)添加一个特殊扩展的 Intent 过滤器。但在文件管理器中,例如 TotalCommander 等 - 这些文件仍然与我的应用程序没有关联,并且当我尝试从文件管理器打开它们时,Android 不建议我的应用程序打开这些文件。但是当我将 Intent 过滤器移至启动器 Activity 时,一切都开始正常工作。所以我想知道 - 扩展的 Intent 过滤器应该只添加到 list 中声明为启动器的 Activity 中?谢谢

这是我的 Intent 过滤器

<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="*/*"/>
<data android:pathPattern=".*\\.myext"/>
</intent-filter>

最佳答案

只需添加主机

<data android:host="*" />

If a host is not specified for the filter, the port attribute and all the path attributes are ignored.

了解更多 here

关于java - 针对非启动器 Activity 的 Android Intent 过滤器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42343537/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com