Im trying to create a simple android native view. Once i get the whole thing . with the renderer to work - it'll be implemented as a camerarecorder view.
My Renderer:
[assembly: ExportRenderer(typeof(CameraPage), typeof(CameraPageRenderer))]
namespace CameraTester2.Droid
{
public class CameraPageRenderer : PageRenderer, TextureView.ISurfaceTextureListener
{
Activity activity;
global::Android.Views.View view;
protected override void OnElementChanged(ElementChangedEventArgs<Page> e)
{
base.OnElementChanged(e);
activity = this.Context as Activity;
view =activity.LayoutInflater.Inflate(Resource.Layout.TestLayout, this, true);
AddView(view);
}
however.. When i add the view - i get a stackoverflow execption, and i just cant figure out why what im doing is wrong.
I've tried following these examples: https://blog.xamarin.com/customize-your-xamarin-forms-app-with-pages-for-each-platform/
http://developer.xamarin.com/guides/cross-platform/xamarin-forms/custom-renderer/contentpage/
Page in Android is a simple page with a label - dont think you need to see it. Page in the shared PCL project is just an empty Xamarin.Forms Xaml page.
Any suggestions?
Also im wondering how to create my own activity - and set it as context. If i try to set the context like this:
protected override void OnElementChanged(ElementChangedEventArgs<Page> e)
{
base.OnElementChanged(e);
activity = this.Context as CameraActivity;
view =activity.LayoutInflater.Inflate(Resource.Layout.TestLayout, this, true);
AddView(view);
}
Activity gets set to null. Thanks in advance for any suggestions.