由网友(你荒凉了我的心)分享简介:我想自定义的文件扩展名与我Xamarin为基础的Android应用程序相关联。我想我的应用程序打开时,用户选择一个特定类型的文件,从文件管理器。我的文件使用扩展名.label,但由于某种原因,我不能让机器人给我的应用程序添加到选择器选择具有该文件扩展名的文件的时候听。不过,如果我使用的.xml扩展它似乎工作。这里是...
我想自定义的文件扩展名与我Xamarin为基础的Android应用程序相关联。我想我的应用程序打开时,用户选择一个特定类型的文件,从文件管理器。
我的文件使用扩展名.label,但由于某种原因,我不能让机器人给我的应用程序添加到选择器选择具有该文件扩展名的文件的时候听。
不过,如果我使用的.xml扩展它似乎工作。这里是的IntentFilter
我使用的:
[IntentFilter的(新[] {Intent.ActionView,Intent.ActionEdit},
分类=新的[] {Intent.CategoryDefault,Intent.CategoryBrowsable},
DataScheme =文件,
DataHost =*,
DataMimeType =* / *,
DataPathPattern =* 的.xml)
解决方案
这结束了工作对我来说:
[IntentFilter的(新[] {Intent.ActionView,Intent.ActionEdit},
分类=新的[] {Intent.CategoryDefault,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")]
相关推荐
最新文章