我正在尝试使用共享意图共享下载的文件。以下引用打开共享菜单,但是当我尝试共享到图片查看器时,出现文件未找到错误。任何帮助,将不胜感激。
public void OpenShareIntent(string fileName) {
var myIntent = new Intent(Android.Content.Intent.ActionView);
var filePath = System.IO.Path.Combine(Environment.GetExternalStoragePublicDirectory(Environment.DirectoryDownloads).AbsolutePath, fileName);
var uri = Android.Net.Uri.Parse(filePath);
myIntent.SetData(uri);
myIntent.SetType(Java.Net.URLConnection.GuessContentTypeFromName(filePath));
Forms.Context.StartActivity(Intent.CreateChooser(myIntent, "Choose an App"));
}
相关分类