/// <summary>
        /// Called when activity started with StartActivityForResult() returns.
        /// </summary>
        /// <param name="requestCode">request code used in StartActivityForResult()</param>
        /// <param name="resultCode">result code</param>
        /// <param name="data">intent data from folder picking</param>
        protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent data)
        {
            base.OnActivityResult(requestCode, resultCode, data);

            if (resultCode == Result.Canceled)
            {
                // Notify user folder picking was cancelled.
                OnFolderPickCancelled();
                this.Finish();
            }
            else
            {
                try
                {
                    if (data?.Data == null)
                    {
                        throw new Exception("Folder picking returned no valid data");
                    }

                    System.Diagnostics.Debug.Write(data.Data);

                    //var uri = data.Data;
                    //Android.Net.Uri testURI = Android.Net.Uri.Parse(uri);
                    var documentFile = DocumentFile.FromTreeUri(this, data.Data);

                    OnFolderPicked(new FolderPickerEventArgs(documentFile.Name, documentFile.Uri.ToString()));
                }
                catch (Exception readEx)
                {
                    System.Diagnostics.Debug.Write(readEx);

                    // Notify user folder picking failed.
                    FolderPickCancelled?.Invoke(
                        this,
                        new FolderPickerCancelledEventArgs
                    {
                        Exception = readEx
                    });
                }
                finally
                {
                    this.Finish();
                }
            }
        }
        /// <summary>
        /// Called when activity started with StartActivityForResult() returns.
        /// </summary>
        /// <param name="requestCode">request code used in StartActivityForResult()</param>
        /// <param name="resultCode">result code</param>
        /// <param name="data">intent data from file picking</param>
        protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent data)
        {
            base.OnActivityResult(requestCode, resultCode, data);

            if (resultCode == Result.Canceled)
            {
                // Notify user file picking was cancelled.
                OnFolderPickCancelled();
                this.Finish();
            }
            else
            {
                try
                {
                    if (data?.Data == null)
                    {
                        throw new Exception("Folder picking returned no valid data");
                    }

                    System.Diagnostics.Debug.Write(data.Data);


                    var uri    = data.Data;
                    var docUri = DocumentsContract.BuildDocumentUriUsingTree(uri, DocumentsContract.GetTreeDocumentId(uri));
                    OnFolderPicked(docUri);
                }
                catch (Exception readEx)
                {
                    System.Diagnostics.Debug.Write(readEx);

                    // Notify user file picking failed.
                    FolderPickCancelled?.Invoke(this, readEx);
                }
                finally
                {
                    this.Finish();
                }
            }
        }
 /// <summary>
 /// Signals event that folder picking was cancelled
 /// </summary>
 private static void OnFolderPickCancelled()
 {
     FolderPickCancelled?.Invoke(null, null);
 }