如何使用我的应用程序+ android xamarin打开图像

时间:2018-11-28 16:33:09

标签: android xamarin file-association

i added intent filter to my activity as below and my application is in list of Open With but what else i need to do to open that image in my application. 

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

我在myactivity中添加了以下代码-onCreate()方法。

if (Intent.Action.Equals(Intent.ActionView))
            {
                   TextView info;
                   info = FindViewById<TextView>(Resource.Id.textView);
                   if (Intent.Scheme.Equals(ContentResolver.SchemeFile))
                   {
                       Android.Net.Uri uri = Intent.Data;
                       //string name = uri.LastPathSegment;
                       Console.WriteLine(uri.Path + "~~~~~");
                   } 
            }

我也在这里获取uri路径,但下一步该怎么做。

非常感谢

0 个答案:

没有答案