SetPage (Xamarin.Forms.Page) - Legacy Error - Android

I created a universal application with Xamarin formats

I get a warning

Xamarin.Forms.Platform.Android.FormsApplicationActivity.SetPage (Xamarin.Forms.Page) 'is deprecated

Has anyone come across this?

The code is shown below.

public class MainActivity : AndroidActivity
{
    protected override void OnCreate (Bundle bundle)
    {
        base.OnCreate (bundle);

        Xamarin.Forms.Forms.Init (this, bundle);    
        SetPage (App.GetMainPage ());
    }
}

Floor

+4
source share
1 answer

Forms 1.3.1 supports a new application class that has a MainPage property that allows you to set the application’s start page in one place (and not once on the platform).

public class App : Application // superclass new in 1.3
{
    public App ()
    {
        // The root page of your application
        MainPage = new ContentPage {...}; // property new in 1.3
    }

A migration guide that lists all the changes you will need to make to the application for the new API.

+7

Source: https://habr.com/ru/post/1569845/


All Articles