我正在尝试将我的活动与特定的文件扩展名相关联。这是我的意图过滤器:
<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"
android:host="*"
android:mimeType="*/*"
android:pathPattern=".*\\.jcrlccip" />
</intent-filter>
但是我仍然无法匹配文件类型。事实上,这并不匹配。
我几乎尝试了所有的排列。 .*
匹配一切; *失败后的任何事情。
我做错了什么?感谢
答案 0 :(得分:0)
你必须尝试这样
<intent-filter>
<action android:name="android.intent.action.VIEW"></action>
<category android:name="android.intent.category.DEFAULT"></category>
<category android:name="android.intent.category.BROWSABLE"></category>
<data android:host="*" android:scheme="file"
android:pathPattern=".*\." />
</intent-filter>
答案 1 :(得分:0)
您在这里使用什么文件扩展名?
你想要像PDF或视频文件或图像文件吗?
示例代码:
<intent-filter>
<action android:name="android.intent.action.VIEW"></action>
<category android:name="android.intent.category.DEFAULT"></category>
<category android:name="android.intent.category.BROWSABLE"></category>
<data android:mimeType="application/pdf" android:scheme="content"></data>
</intent-filter>