Android的文件关联 [英] Android File Associations

查看:137
本文介绍了Android的文件关联的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的清单:

<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=".*mht" />
    <data android:scheme="https" android:host="*" android:pathPattern=".*mht" />
</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:mimeType="message/rfc822" android:scheme="http" />
    <data android:mimeType="multipart/related" android:scheme="http" />
    <data android:mimeType="message/rfc822" android:scheme="https" />
    <data android:mimeType="multipart/related" android:scheme="https" />
</intent-filter>

结果:

  • http://authman.net/keepme.mht <--- chooser does not display my program as an option
  • http://authman.net/flipcode.mht <--- chooser displays my program as an option

很好奇,不是吗?我在做什么错在这里?同样怪异 - 我的表现:

Very curious, no? What am I doing wrong here? Equally as weird -- my manifest:

<intent-filter
    android:icon='@drawable/ic_launcher'
        android:label='AndroidMHT File'
    android:priority='1'>
    <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" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:scheme="file" />
    <data android:scheme="content" />
    <data android:mimeType="*/*" />
    <data android:pathPattern=".*\\.mht" />
    <data android:host="*" />
</intent-filter>

结果:


  • /mnt/SDCARD/Android/data/com.mht/files/flipie.mht&LT; ---选择器不显示我的程序作为一个选项

  • /mnt/SDCARD/Android/data/com.mht/files/keepme.mht&LT; ---选择器将显示我的程序作为一个选项

我在两端白衣。任何帮助多少AP preciated。

I'm at ends whit. Any assistance much appreciated.

推荐答案

在第一个答案的建议在这里帮我:<一href=\"http://stackoverflow.com/questions/3760276/android-intent-filter-associate-app-with-file-extension\">Android意图过滤器,联想应用程序文件扩展

The suggestions in the first answer here helped me: Android intent filter, associate app with file extension

这是我的新清单,对于那些谁可能会从中受益:

This is my new manifest, for those who may benefit from it:

<intent-filter
    android:icon='@drawable/ic_launcher'
        android:label='AndroidMHT File'
    android:priority='1'>
    <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" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:mimeType="*/*" />
    <data android:pathPattern="*.mht" />
</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="http" android:host="*" android:pathPattern=".*\\.mht" />
    <data android:scheme="https" android:host="*" android:pathPattern=".*\\.mht" />
</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:mimeType="message/rfc822" android:scheme="http" />
    <data android:mimeType="multipart/related" android:scheme="http" />
    <data android:mimeType="message/rfc822" android:scheme="https" />
    <data android:mimeType="multipart/related" android:scheme="https" />
</intent-filter>

这篇关于Android的文件关联的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆