Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android UINavigationController-like feature

On the iPhone I use a Navigation Controller to push and pop Views from. Very handy.

Is there an equivalent in Android?

like image 745
Ian Vink Avatar asked Jul 15 '10 01:07

Ian Vink


People also ask

What is NavController in Android?

NavController manages app navigation within a NavHost . Apps will generally obtain a controller directly from a host, or by using one of the utility methods on the Navigation class rather than create a controller directly. Navigation flows and destinations are determined by the navigation graph owned by the controller.

How do you use screen navigation on Android?

Gesture navigation: Swipe up from the bottom, hold, then let go. 2-button navigation: From the bottom of your screen, swipe up to the middle. 3-button navigation: Tap Overview .

What is the purpose of the navigation host?

Nav Host: The Nav Host is an empty container that displays all destinations from your navigation graph. The navigation component has a default navhost implementation which displays the fragment destinations. NavController: The NavController is an object that manages app navigation within a Nav Host.


1 Answers

This is an old question, but I believe the answer has changed. It is now possible to imitate the Nav stack in iOS in android using Fragments. http://developer.android.com/reference/android/app/Fragment.html

Basically instead of jumping from Activity to Activity you instead stay in one Activity that controls the display, organization, and animation of Fragments which each contain their own behavior much like the NavController / UIViewController model in iOS.

It is also backwards compatible as a static library so you can implement it on pre-Honeycomb devices. Strategies for Honeycomb & backward compatibility

like image 121
Andrew Avatar answered Oct 15 '22 09:10

Andrew