I'm trying to get Oxyplot to run with Xamarin for an Android app. The documentation states the following:
Initialize renderers
You need to initialize the OxyPlot renderers by adding the following call just after Xamarin.Forms.Forms.Init():
iOS (Unified API): OxyPlot.Xamarin.Forms.Platform.iOS.PlotViewRenderer.Init(); Android: OxyPlot.Xamarin.Forms.Platform.Android.PlotViewRenderer.Init(); Universal Windows: OxyPlot.Xamarin.Forms.Platform.UWP.PlotViewRenderer.Init(); Windows Phone: OxyPlot.Xamarin.Forms.Platform.WP8.PlotViewRenderer.Init();
Tip: Search for “Xamarin.Forms.Forms.Init()” in your solution to find all the places you need to add code.
I searched for "Xamarin.Forms.Forms.Init()" in my solution but this string is nowhere to be found. Any hints on how to proceed from here and how to get a simple oxyplot sample application to run?
The call Xamarin.Forms.Forms.Init()
is called in protected override void OnCreate
in MainActivity.cs
.
[Activity(Label = "fooApp", Icon = "@drawable/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
protected override void OnCreate(Bundle bundle)
{
TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar;
base.OnCreate(bundle);
global::Xamarin.Forms.Forms.Init(this, bundle);
OxyPlot.Xamarin.Forms.Platform.Android.PlotViewRenderer.Init();
LoadApplication(new App());
}
}