I want to open Xamarin forms page from Xamarin Android project. On android project I created toolabar item image, where I am calling event to open page from Xamarin forms project.
Here is my MainActivity.cs toolabar image item implementation:
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity
{
private IMenu CurrentMenu { get; set; }
private ImageView imgSmallC { get; set; }
public override bool OnCreateOptionsMenu(IMenu menu)
{
ActionBar.DisplayOptions = ActionBarDisplayOptions.HomeAsUp | ActionBarDisplayOptions.ShowCustom | ActionBarDisplayOptions.ShowTitle | ActionBarDisplayOptions.ShowHome;
LayoutInflater inflater = (LayoutInflater)ActionBar.ThemedContext.GetSystemService(LayoutInflaterService);
View customActionBarView = inflater.Inflate(Resource.Layout.actionbar_custom_view_done, null);
imgSmallC = (ImageView)customActionBarView.FindViewById<ImageView>(Resource.Id.ImgSmallC);
imgSmallC.Click += (object sender, EventArgs args) =>
{
StartActivity(typeof(MyPopupPage));
};
return base.OnCreateOptionsMenu(menu);
}
}
In StartActivity I am calling MyPopupPage.xaml page from Xamarin forms project, but unfortunately when I am debugging project and I click on toolbar image I get such a error:
See Question&Answers more detail:osSystem.ArgumentException: type Parameter name: Type is not derived from a java type.