关联文件扩展名与Xamarin的Andr​​oid应用 [英] Associate file extension with Xamarin Android application

查看:232
本文介绍了关联文件扩展名与Xamarin的Andr​​oid应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想自定义的文件扩展名与我Xamarin为基础的Andr​​oid应用程序相关联。我想我的应用程序打开时,用户选择一个特定类型的文件,从文件管理器。

我的文件使用扩展名.label,但由于某种原因,我不能让机器人给我的应用程序添加到选择器选择具有该文件扩展名的文件的时候听。

不过,如果我使用的.xml扩展它似乎工作。这里是的IntentFilter 我使用的:

  [IntentFilter的(新[] {Intent.ActionView,Intent.ActionEdit},
分类=新的[] {Intent.CategoryDe​​fault,Intent.CategoryBrowsable},
DataScheme =文件,
DataHost =*,
DataMimeType =* / *,
DataPathPattern =* \\的.xml)
 

解决方案

这结束了​​工作对我来说:

  [IntentFilter的(新[] {Intent.ActionView,Intent.ActionEdit},
    分类=新的[] {Intent.CategoryDe​​fault,Intent.CategoryBrowsable},
    DataScheme =文件,
    DataHost =*,
    DataPathPattern =* \\\\。标签)
 

I am trying to associate a custom file extension with my Xamarin-based Android application. I would like my application to open when the user chooses a particular type of file from the file manager.

My files use the extension ".label" but for some reason I cannot get Android to add my app to the chooser listen when selecting a file with such file extension.

However, if I use the ".xml" extension it seems to work. Here is the IntentFilter I am using:

[IntentFilter(new[] { Intent.ActionView, Intent.ActionEdit },
Categories = new[] { Intent.CategoryDefault, Intent.CategoryBrowsable },
DataScheme = "file",
DataHost = "*",
DataMimeType = "*/*",
DataPathPattern = ".*\\.xml")]

解决方案

This ended up working for me:

[IntentFilter(new[] { Intent.ActionView, Intent.ActionEdit },
    Categories = new[] { Intent.CategoryDefault, Intent.CategoryBrowsable },
    DataScheme = "file", 
    DataHost = "*",     
    DataPathPattern = ".*\\\\.label")]

这篇关于关联文件扩展名与Xamarin的Andr​​oid应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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