我已经创建了自己的文件类型(.mmd)。这个文件类型我已经保存了一些数据,并且希望,当在我的应用程序中选择一个这种类型的文件来打开它时,在名为openMeasurement的子活动中。
我的清单已被更改,因此该活动具有以下属性,这些属性是我从另一个线程获得的。但这似乎还不够
<activity android:name="OpenMeasurement">
<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="http" android:host="*"
android:pathPattern=".*\\.mmd" />
<data android:scheme="https" android:host="*"
android:pathPattern=".*\\.mmd" />
<data android:scheme="content" android:host="*"
android:pathPattern=".*\\.mmd" />
<data android:scheme="file" android:host="*"
android:pathPattern=".*\\.mmd" />
</intent-filter>
</activity>我做错了什么\忘记任何可以帮助的人?提前-Thanks一大堆。
编辑1:
可能是因为我只在我的真实手机上调试,因此没有安装和获得所有的具体要求,真的不应该是这样的,如果你也这样认为的话,我想对它做一些评论。-Edit3-它似乎在手机上注册了“打开的文件类型”,即使在“调试模式”下,因为我可以注册一个.pdf文件
编辑2:好的,我试着把它分开,删除了HTTP方案,因为我认为它们是不必要的。现在代码看起来像这样:
<activity android:name="OpenMeasurement">
<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:host="*" />
<data android:pathPattern=".*\\.mmd" />
</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="file" />
<data android:host="*" />
<data android:pathPattern=".*\\.mmd" />
</intent-filter>
</activity>当我选择我的文件时,它仍然没有打开,也没有给出选择(使用“我的文件”)
我也尝试过在pathpattern (".*\.mmd")中使用双重转义,但也没有帮助。
编辑4:还尝试添加:
<data android:mimetype="*/*"/>但还是没有joy :'-(
发布于 2011-12-06 23:28:24
这在一般情况下是不可行的,因为意图机制是与MIME类型一起工作的,并且您只能使用预定义的MIME类型。
请参阅http://code.google.com/p/android/issues/detail?id=11112
所以:你不能让它在本地文件资源管理器中工作,比如ASTRO,因为它可能会像ACTION_VIEW intent for a file with unknown MimeType - ie中描述的那样使用内置的MimeTypeMap。
但是,如果文件位于web上,则可以截获web浏览器的URL打开机制,如http://groups.google.com/group/android-developers/browse_thread/thread/d79bfa05528cbbee#中所述
发布于 2014-01-09 11:54:04
如果您使用双重变通方法,这实际上是可能的。你只需对交叉线进行双重散列,它应该允许你使用该文件类型,但前提是它是mark40类型的angelo,而且你总是可以通过简单的下载来升级通用的mark35。
https://stackoverflow.com/questions/8212027
复制相似问题