Navigation on Android Mobile Apps

0

Talk to people.

I have an application published on Windows Phone where I navigate between pages without having to worry about the history, that is, if the user presses the Back button of Windows Phone, it automatically returns to the previous page. Similar to IE or Firefox, for example.

For clarity, suppose the Search.xaml page lists the result of a search.

In this result you have a link to the details of the registry. When the user clicks I send it to the Detail page.xaml? Id = 1

In the detail page Detail.xaml has another link to another reference. So, I redirect the user to the same page Detail.xaml? Id = 2.

And so on.

I get the same result on Android?

Remembering that in WP, I do not worry about the history of pages because it returns to the previous page without any intervention in code.

Hugs.

    
asked by anonymous 11.08.2016 / 18:20

1 answer

2

Android has a mechanism similar to Windows Phone, the "pages" are stacked so that when you press the back button, the Activity is closed and the previous one is displayed, if you do not have a previous Activity, the app closes or performs an action (go to the background, for example).

While on Windows Phone you go to another page using Navigate on Android, you create a Intent .

    Intent intent = new Intent(AtualActivity.this, ProximaActivity.class);
    startActivity(intent);

Where AtualActivity.this refers to Activity current and ProximaActivity.class refers to Activity where you want to go.

Then to go back to previous Activity, just call finish or let the back button take care of it for you.

    finish();

Passing and returning parameters is done in a similar way.

In short: Navigation works just like Windows Phone.

You can learn more about:

Intents - link

Navigation operation - link and link

    
20.01.2017 / 01:37