在Android中注册新文件类型

我想在Android上编写一个简单的STL(几何数据文件)查看器应用程序,但无法识别系统的格式。我在我的应用清单文件中写了这个:


<intent-filter>

    <action android:name="android.intent.action.VIEW" />

    <action android:name="android.intent.action.EDIT" />

    <action android:name="android.intent.action.PICK" />

    <category android:name="android.intent.category.DEFAULT" />

    <data android:scheme="http" />

    <data android:pathPattern=".*\\.stl" />

    <data android:mimeType="application/sla" />

    <data android:host="*" />

</intent-filter>

但是,当我启动浏览器并下载一些示例STL文件时,下载被中断,并且我报告系统的数据文件类型未知。


我没有真正的Android设备,所以我只使用一个仿真器,并且在开发中我在MonoDroid上使用C#(但老实说我不认为这是问题所在)。


我该如何解决这个问题?


至尊宝的传说
浏览 675回答 3
3回答

四季花海

我尝试了其他解决方案,这是唯一对我有用的解决方案:<intent-filter&nbsp; &nbsp; android:icon="@drawable/icon"&nbsp; &nbsp; android:label="Armro File"&nbsp; &nbsp; android:priority="1" >&nbsp; &nbsp; <action android:name="android.intent.action.VIEW" />&nbsp; &nbsp; <category android:name="android.intent.category.DEFAULT" />&nbsp; &nbsp; <category android:name="android.intent.category.BROWSABLE" />&nbsp; &nbsp; <data android:scheme="http" />&nbsp; &nbsp; <data android:scheme="https" />&nbsp; &nbsp; <data android:scheme="ftp" />&nbsp; &nbsp; <data android:scheme="file" />&nbsp; &nbsp; <data android:host="*" />&nbsp; &nbsp; <data android:mimeType="*/*" />&nbsp; &nbsp; <data android:pathPattern=".*\\.myowntype" /></intent-filter>为什么其他的都不起作用?
打开App,查看更多内容
随时随地看视频慕课网APP