首页 > 解决方案 > 是否可以支持自定义扩展文件?

问题描述

如果我们有一个像.abc这样的自定义扩展名的文件,我可以用应用程序打开这个文件吗?

我们如何在“打开方式”选项的建议列表下显示我们的应用程序?

标签: androidandroid-sharing

解决方案


你可以在你的AndroidManifest.xml

<activity ...>
    <intent-filter>
      <action android:name="android.intent.action.VIEW" />
      <category android:name="android.intent.category.DEFAULT" />
      <data android:scheme="file"  
          android:host="*" 
          android:pathPattern=".*\\.abc" 
          android:mimeType="*/*" />
    </intent-filter>
</activity>

更多阅读:https ://developer.android.com/guide/components/intents-filters 。


推荐阅读