public static void OpenFile(Context context, Android.Net.Uri file, string mimeType) { try { Intent i = new Intent(Intent.ActionView); i.SetDataAndType(file, mimeType); i.AddFlags(ActivityFlags.GrantReadUriPermission); i.AddFlags(ActivityFlags.NewTask); // ? context.StartActivity(i); } catch (Exception ex) { ToastHelper.ShowToast(context, "Cannot open file.", ToastLength.Long); Log.Debug(TAG, "Cannot open file: " + ex.ToString()); } }
private async static void TextReceiver_TextReceiveFinished(TextTransfer.TextReceiveEventArgs e) { try { Activity.Invoke(); if (!e.Success) { ToastHelper.ShowToast(context, "Failed to receive text.", ToastLength.Long); return; } await ClipboardHelper.CopyTextToClipboard(context, (Guid)e.Guid); Finish?.Invoke(); } finally { await progressNotifier?.ClearProgressNotification(); } }