Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Closing a Native Form opened from within Forms and passing data back

$
0
0

I have opened a native form as per the example in GitHub. In the renderer I created, I start a new activity.

In the native activity, I'm capturing a barcode using the Scandit library. When I scan, I want to close the form and return the control back to my application. I've given this a few goes, and gone around in circles.

1st attempt was to not create a new activity, instead to put the barcode scanning in the Renderer. It does capture the barcode and because I can get access back to my forms page I can send the data I capture to that. However, I can't close the page. If I try Navigation.PopAsync() when I get the barcode I get an exception.

2nd attempt was to create a new activity, in the renderer just StartActivity. I can capture the barcode, and I can call Finish because I started an activity. But, I can't seem to figure out how to notify my original page that there is a barcode so I can't get back to the call to Navigation.PopAsync(). So I end up with an empty page once the barcode scanner goes away, that I have to hit back on to pop that.

A little bit more to this.

In my renderer I can't call StartActivityForResult, because I'm not able to create the event handler for the Activity Result to be handled by.


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>