Skip to content

Instantly share code, notes, and snippets.

@Mrnikbobjeff
Created October 12, 2020 10:22
Show Gist options
  • Save Mrnikbobjeff/547b227d25ad4b9c5381f383f14289be to your computer and use it in GitHub Desktop.
Save Mrnikbobjeff/547b227d25ad4b9c5381f383f14289be to your computer and use it in GitHub Desktop.
protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
{
base.OnActivityResult(requestCode, resultCode, data);
// we have a valid GUID, so handle the task
if (!string.IsNullOrEmpty(guid) && pendingTasks.TryRemove(guid, out var tcs) && tcs != null)
{
if (resultCode == Result.Canceled)
{
tcs.TrySetCanceled();
}
else
{
if (resultCode != Result.Ok)
{
tcs.SetException(new Exception("Activity returned non-OK result code."));
}
if (data != null && outputUri != null)
{
data.PutExtra(OutputUriExtra, outputUri);
}
else if (data == null && outputUri != null)
{
data = new AndroidIntent();
data.PutExtra(OutputUriExtra, outputUri);
}
tcs.TrySetResult(data);
}
}
// close the intermediate activity
Finish();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment