redzer101 redzer101 - 1 year ago 71
Android Question

Xamrin.Forms Navigation.PopAsync not changing page on android

I have a login button, which when clicked triggers this method:

async void OnLoginButtonClicked(object sender, EventArgs e)
Navigation.InsertPageBefore(new SiteSelectionPage(), this);
await Navigation.PopAsync();

On iOS it works fine and the new page and title appear. On Android the title of the page changes from "Login" to "Site Selection" (which is what I want), but the content does not change at all (the username and password Entry boxes are still on the page).

Does anyone know why this is happening specifically on Android?

Answer Source

I can see in your code that you are trying to login the user, so what you can try is changing the App.MainPage in stead of doing that:

Application.Current.MainPage = new NavigationPage(new SiteSelectionPage());

Then if you want to remember if the user is already logged in you can try storing a Setting with this NuGet Package: