Questions tagged [android-architecture-navigation]

The Navigation Architecture Component provides a framework for in-app navigation for Android apps.

The Navigation Architecture Component is released as a part of Android JetPack and AndroidX package. It simplifies the navigation implementation in Android Apps. Its goal is to provide consistent and predictable experience to the end users, with single Activity Architecture. It also has support for Fragments and Deep-links. It has Navigation graph at the core of the library. Navigation Graph describes how the activities and fragments are related to each other and how the transition will work.

1077 questions
187
votes
38 answers

IllegalArgumentException: navigation destination xxx is unknown to this NavController

I am having an issue with the new Android Navigation Architecture component when I try to navigate from one Fragment to another, I get this weird error: java.lang.IllegalArgumentException: navigation destination XXX is unknown to this…
184
votes
13 answers

How to clear navigation Stack after navigating to another fragment in Android

I am using The new Navigation Architecture Component in android and I am stuck in clearing the navigation stack after moving to a new fragment. Example: I am in the loginFragment and I want this fragment to be cleared from the stack when I…
84
votes
7 answers

Fragments destroyed / recreated with Jetpack's Android Navigation components

I'm trying to implement Navigation with Jetpack's architecture components in my existing app. I have a single activity app where the main fragment (ListFragment) is a list of items. Currently, when the user taps on a list item a second fragment is…
81
votes
13 answers

IllegalStateException: Link does not have a NavController set

I'm using Android Navigation Component for Navigation. I have a LoginFragment which has a button to transition to SignUpFragment. On clicking the button I'm getting this error. java.lang.IllegalStateException: View…
73
votes
14 answers

Android Jetpack Navigation, BottomNavigationView with Youtube or Instagram like proper back navigation (fragment back stack)?

Android Jetpack Navigation, BottomNavigationView with auto fragment back stack on back button click? What I wanted, after choosing multiple tabs one after another by user and user click on back button app must redirect to the last page he/she…
67
votes
5 answers

Is it possible to set startDestination conditionally using Android Navigation Architecture Component(Android Jetpack)?

I am using Navigation from Android Jetpack to navigate between screens. Now I want to set startDestination dynamically. I have an Activity named MainActivity And two Fragments, FragmentA & FragmentB. var isAllSetUp : Boolean = // It is dynamic and…
Akash Patel
  • 2,093
  • 1
  • 12
  • 20
64
votes
7 answers

Add (not replace) fragment with navigation architecture component

I have an activity with a product list fragment and many other fragments and I am trying to use architecture component navigation controller. The problem is: it replaces the (start destination) product list fragment and I don't want the list to be…
63
votes
7 answers

How to get a result from fragment using Navigation Architecture Component?

Let's say that we have two fragments: MainFragment and SelectionFragment. The second one is build for selecting some object, e.g. an integer. There are different approaches in receiving result from this second fragment like callbacks, buses etc.…
62
votes
7 answers

How to change start destination of a navigation graph programmatically [Jetpack]

Basically, I have the following navigation graph: I want to change my starting point in navigation graph to fragment 2 right after reaching it (in order to prevent going back to fragment 1 when pressing back button - like with the splash…
62
votes
13 answers

Dynamic ActionBar title from a Fragment using AndroidX Navigation

I am using the new Navigation component from Android Jetpack. The root Activity setup is quite simple: override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) …
Jonas Schmid
  • 4,668
  • 5
  • 33
  • 59
62
votes
9 answers

Navigation Architecture Component- Passing argument data to the startDestination

I have an activity A that start activity B passing to it some intent data. Activity B host a navigation graph from the new Navigation Architecture Component.I want to pass that intent data to the startDestination fragment as argument how to do that?
61
votes
10 answers

Navigation Architecture Component - Dialog Fragments

Is it possible to use the new Navigation Architecture Component with DialogFragment? Do I have to create a custom Navigator? I would love to use them with the new features in my navigation graph.
52
votes
6 answers

Equivalent of startActivityForResult() with Android Architecture Navigation

I have a workflow with 3 screens. From "screen 1" to access to "screen 2", the user must accept some kind of terms and conditions that I call in my picture "modal". But he only has to accept those conditions once. The next time he is on the first…
Jonas Schmid
  • 4,668
  • 5
  • 33
  • 59
49
votes
3 answers

Navigation Architecture Component - Activities

I've been following the docs from Navigation Architecture Component to understand how this new navigation system works. To go/back from one screen to another you need a component which implements NavHost interface. The NavHost is an empty view…
Víctor Albertos
  • 7,314
  • 5
  • 36
  • 61
44
votes
6 answers

Plugin with id 'androidx.navigation.safeargs' not found

When I try to add Safe Args (Android Navigation) to my app's as following ( using this guide : https://developer.android.com/topic/libraries/architecture/navigation/navigation-pass-data ) : apply plugin: 'com.android.application' apply plugin:…
AVEbrahimi
  • 13,285
  • 12
  • 70
  • 151
1
2 3
71 72