Reputation: 33
I am working with the Xamarin forms app that uses native camera. I am trying to switch from Forms to Native and then back to forms based on https://github.com/supreettare/Forms2Native2Forms/blob/master/FormsBasics.Android/FormsActivity.cs
in Android: SetPage (App.GetSecondPage ());
in Forms:
public static Page GetSecondPage ()
{
var formsPage = new NavigationPage (new MyThirdPage ());
return formsPage;
}
My concern is when I call this function it gives me android.view.InflateException: Binary XML file line #1: Error inflating class.
If I do SetPage(new GetSecondPage()), I can navigate to the other page but then can not use Navigation.PushAsync() anywhere on that page.
Upvotes: 0
Views: 120
Reputation: 14956
Have you tried to use Page.CreateSupportFragment
method ?
In your activity,you could load the page which defined in your forms like
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
Forms.Init(this, bundle);
SetContentView(Resource.Layout.Main);
Android.Support.V4.App.Fragment mainPage = YourPage.CreateSupportFragment(this);
SupportFragmentManager
.BeginTransaction()
.Replace(Resource.Id.fragment_frame_layout, mainPage)
.Commit();
}
you could refer to Nativie Forms
Upvotes: 0