Skip to content

Instantly share code, notes, and snippets.

@icebeam7
Created April 10, 2020 23:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save icebeam7/e12e22d52b2e9164b48e0a97c7ed0e5f to your computer and use it in GitHub Desktop.
Save icebeam7/e12e22d52b2e9164b48e0a97c7ed0e5f to your computer and use it in GitHub Desktop.
Partial implementation of SaveAndroid.cs
public async Task SaveAndView(string fileName, String contentType, MemoryStream stream)
{
//...
if (file.Exists())
{
var path = Android.Net.Uri.FromFile(file);
var extension = MimeTypeMap.GetFileExtensionFromUrl(Android.Net.Uri.FromFile(file).ToString());
var mimeType = MimeTypeMap.Singleton.GetMimeTypeFromExtension(extension);
var intent = new Intent(Intent.ActionView);
intent.SetDataAndType(path, mimeType);
Forms.Context.StartActivity(Intent.CreateChooser(intent, "Choose App"));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment