Steady model of Android Jetpack Navigation Staff

Posted by Ian Lake, Software program Engineering Supervisor, and Jisha Abubaker, Product Supervisor

Tooling and constant steering for the implementation of a predictable in-app navigation

Right now, we’re happy to announce the discharge of the secure model of the Android Jetpack Navigation element.

The suite of libraries of the Jetpack navigation element tooling and steering supplies a whole and sturdy navigation framework, liberating you from the difficulties of implementing navigation and bringing you certainty. that every one peripheral circumstances are dealt with accurately.

With the Jetpack navigation element, you’ll be able to:

Handle primary consumer actions, such because the Up & Again buttons, in order that they work constantly on units and shows.

Enable customers to land on any a part of your software by means of deep hyperlinks and create constant and predictable navigation inside your software.

Enhance the kind of safety arguments handed from one display to the opposite, which reduces the prospect of runtime blocking as customers navigate your software.

Add crusing experiences comparable to Navigation Drawers and Backside Navigation in accordance with the rules for the design of kit.

Visualize and simply manipulate your navigation feeds with the Android Studio three.three browser editor.

The Jetpack navigation element adheres to navigation ideas, offering constant and predictable navigation, irrespective of how easy or advanced your software is.

Simplify the navigation code with the Jetpack navigation libraries

The Jetpack Navigation element supplies an in-app navigation framework that means that you can summary implementation particulars whereas preserving your software code with out navigating.

To familiarize your self with the Jetpack navigation element of your undertaking, add the navigation artifacts accessible on the Google Maven repository in Java or Kotlin to the construct.gradle file in your software:

dependencies
def nav_version = 2.zero.zero

// Java
implementation "androidx.navigation: fragment-navigation: $ nav_version"
implementation "androidx.navigation: navigation-ui: $ nav_version"

// Kotlin KTX
implementation "androidx.navigation: navigation-fragment-ktx: $ nav_version"
implementation "androidx.navigation: navigation-ui-ktx: $ nav_version"

Be aware : In case you have not but migrated to androidx. * Jetpack's secure element libraries are additionally accessible as android.arch artifacts. * In model 1.zero.zero.

navigation-runtime: This essential library feeds the navigation graph, which supplies the construction of your navigation within the software: the screens or locations that make up your software and the actions that bind them. You possibly can management navigation to locations with a easy navigation name (). These locations will be fragments, actions or personalised locations.

navigation-fragment: This library depends on navigation-runtime and supplies rapid assist for fragments as locations. With this library, fragment transactions at the moment are mechanically dealt with for you.

navigation-ui: This library means that you can simply add navigation drawers, menus and backside navigation to your software, in accordance with the fabric creation pointers.

Every of those libraries supplies a KTX Android artifact with the -ktx suffix that’s based mostly on the Java API, profiting from Kotlin's language-specific options.

Instruments to Assist You Create Predictable Navigation Workflows

Obtainable in Android Studio three.three and later, the Navigation Editor means that you can visually create your navigation graph, which lets you handle consumer journeys in your software.

By means of integration into the manifest merge software, Android Studio can mechanically generate the mandatory intent filters to permit deep linking to a selected display of your software. With this characteristic, you’ll be able to hyperlink URLs to any display in your software by merely setting an attribute on the navigation vacation spot.

Navigation usually requires transmitting knowledge from one display to a different. For instance, your listing display can cross an merchandise ID to a particulars display. Many of the runtime exceptions whereas searching had been attributed to a scarcity of safety sort assure when forwarding arguments. These exceptions are troublesome to copy and debug. Discover out how one can make sure the safety of the compilation sort with the Protected Args Gradle plug-in .

Ideas for getting it proper the primary time

Try our model new set of growth guides that embody finest practices that can assist you implement navigation correctly:

What the builders say

Right here's what Emery Coxe, Android Lead @ HomeAway, has to say in regards to the Jetpack navigation element:

"The navigation library is properly designed and absolutely configurable, permitting us to combine it based on our particular wants.

With the navigation library, we restructured our legacy navigation drawer to assist dynamic, run-time configuration utilizing customized views. This allowed us so as to add / take away new screens to the top-level expertise of our software with out creating interdependence between modules packaged in a discrete means.

We had been additionally in a position to do away with all of the anti-patterns of our software concerning high-level navigation, eradicating express conversions and hard-coded assumptions to somewhat rely straight on Navigation. This library is a elementary element of contemporary Android growth, and we intend to undertake it extra extensively all through our software to maneuver ahead.

Begin

See the migration information and developer information for info on how one can begin utilizing the Jetpack Navigation element in your software. We additionally supply a sensible code and an instance of software.

Try Google's digital well-being for an additional concrete instance of in-app navigation utilizing the Jetpack Android navigation element.

Feedback

Please proceed to inform us about your expertise with the Navigation element. In case you have particular feedback in regards to the options or when you’ve got issues, please register a bug through one of many following hyperlinks: