Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

How to work around PushAsync is not supported globally on Android?

$
0
0

I've got a ContentPage which is nested within a MasterDetailPage.

I'm trying to use PushAsync(new SomePage()); but it keeps on throwing this error.

PushAsync is not supported globally on Android, please use a NavigationPage

Unfortunately it doesn't really describe "how" to use a NavigationPage.

I did try PushAsync(new NavigationPage(new SomePage()));, but that too fails.

Also of note. I actually use App.Navigation.PushAsync as well as App.Navigation.PushModalAsync (Modal works), and it's set like this.

// PCL
public class App {
    public static INavigation Navigation {
        get;
        set;
    }
    public static Page GetMainPage(IContainer container) {
        Container = container;
        return Container.Resolve < MainPage > ();
    }
}

// Platform
public class MainActivity: AndroidActivity {
    protected override void OnCreate(Bundle bundle) {
        base.OnCreate(bundle);
        Forms.Init(this, bundle);
        var container = RegisterDependencies();
        var page = App.GetMainPage(container);
        App.Navigation = page.Navigation;
        SetPage(page);
    }
}

Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>