Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android only allows one navigation page on screen at a time using

what is the difference between 2 implementations below?

 public App()
    {
        // The root page of your application
        MainPage = new Views.MainPage();
    }   
 public App()
    {     
        MainPage = new NavigationPage(new MainPage());
    }

if my main page inherits MasterDetailPage, 1st code above will work but 2nd one will return error message telling me that "android only allows one navigation page on screen at a time" when I debug my android app.

  public class MainPage : MasterDetailPage
    {

        MasterPage masterPage;
        public MainPage()
        {
            masterPage = new MasterPage();
            Master = masterPage;
            Detail = new NavigationPage(new AnotherPage());
like image 251
Emil Avatar asked Dec 22 '15 00:12

Emil


People also ask

What is up navigation key?

The Up button is used to navigate within an app based on the hierarchical relationships between screens. For instance, if screen A displays a list of items, and selecting an item leads to screen B (which presents that item in more detail), then screen B should offer an Up button that returns to screen A.

How does the Android back button work?

The Back button appears in the system navigation bar at the bottom of the screen and is used to navigate in reverse-chronological order through the history of screens the user has recently worked with.

What provides easy start and navigation between application?

Android Jetpack's Navigation component helps you implement navigation, from simple button clicks to more complex patterns, such as app bars and the navigation drawer. The Navigation component also ensures a consistent and predictable user experience by adhering to an established set of principles.


1 Answers

I might be a bit confused by what you are asking but if you are doing

MainPage = new NavigationPage(new MainPage());

And your MainPage is

public class MainPage : MasterDetailPage
{

    MasterPage masterPage;
    public MainPage()
    {
        masterPage = new MasterPage();
        Master = masterPage;
        Detail = new NavigationPage(new AnotherPage());

Then you are doing

NavigationPage > MasterDetailPage > NavigationPage

Either MasterDetail or Navigation should be the root and not have them inside each other. You can't have 2 navigation pages within each other.

like image 121
Adam Avatar answered Oct 15 '22 23:10

Adam