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.

1346 questions
15
votes
3 answers

Fragments are always recreated when used with Android navigation from jetpack

I am facing this issue of fragments recreation with Android navigation component. I have integrated bottom navigation and coupled it with the android navigation component. So, every time I click on a tab on bottom bar, the fragment is recreated and…
15
votes
1 answer

Android deeplink with navigation component not working as expected

I hope you are all doing well. I have a little question; I am using navigation component, single activity multiple fragment. I have a tiny problem with deeplink. I’ve set in manifest and also set launcherMode="singleTask", I’ve set…
15
votes
2 answers

Navigate between different graphs with Navigation components

I have two activities, one holds all the fragments for the Login process, and the other one holds all the fragments for the main app. Let's say I want to navigate from Activity1 (that holds all navigation graph of Login) to Activity2 (That holds all…
SNM
  • 5,625
  • 9
  • 28
  • 77
15
votes
2 answers

Navigation Architecture Component - DestinationFragmentArgs is not generated

I have this in app gradle: apply plugin: 'androidx.navigation.safeargs' implementation 'android.arch.navigation:navigation-fragment-ktx:1.0.0' implementation 'android.arch.navigation:navigation-ui-ktx:1.0.0' and this in the project…
MorZa
  • 2,215
  • 18
  • 33
15
votes
2 answers

Architecture Navigation Component : onCreateView gets called every time

Everytime fragment instance is created and reloading when you press back. How to overcome this issue? Inability of having proper backstack in nav controller is a huge productivity issue. Hope it's a missing feature or a work-around made on…
15
votes
1 answer

How to set tag for fragments in Navigation Component Architecture

recently I started using Navigation Component Architecture, now there's a problem I have. in previous fragment transactions we could set tag while transacting to another fragment, how can we do that while using Navigation Component Architecture.
SinaMN75
  • 6,742
  • 5
  • 28
  • 56
15
votes
3 answers

Send argument through PendingIntent of NavDeepLinkBuilder

I'm having some difficulties sending an argument through a PendingIntent of a notification using NavDeepLinkBuilder. I'm able to get the destination Activity to launch by clicking the notification, but the Activity's Intent doesn't contain the…
15
votes
3 answers

Android JetPack navigation with multiple stack

I'm using Jetpack Navigation version 1.0.0-alpha04 with bottom navigation. It works but the navigation doesn't happen correctly. For example, if I have tab A and tab B and from tab A I go to Page C and from there I go to tab B and come back to tab A…
15
votes
1 answer

Android Jetpack Navigation: How to get fragment instance of destination in OnNavigatedListener?

I'm using Jetpack Navigation Components in android development (One activity, many fragments). I want to get fragment instance of destination in OnNavigatedListener like below. Is it possible? class MainActivity : AppCompatActivity() { private…
15
votes
1 answer

Destination with arguments or actions must have 'name' or 'id' attributes

I created a global action with the Android Navigation Component and I'm getting the following error when compiling the code
15
votes
4 answers

Android onBackPressed handling with new Navigation component

I need some suggestions; I'm experimenting with Navigation library. I have a fragment which has a webView. I want to check if it canGoBack and do so if it can, otherwise not interfere. 1. Interface approach: Since Navigation is handling…
14
votes
1 answer

How to use global actions declared inside a nested graph from the outer graph?

I tried to use a global action using Safe Args with nested graphs but I got an error. FragmentA.kt: class FragmentA : Fragment() { override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View?…
14
votes
3 answers

How to reuse a fragment in different navigation graphs with safe args enabled?

I'm trying to reuse a fragment in different navigation graphs with safe args enabled. I noticed that if the actions are different I get a compilation error. This is because the xxxFragmentDirections autogenerated code will only generate one of the…
14
votes
3 answers

how to pass a value back to previous fragment destination using Android navigation component?

let sat I have some destinations like this from fragment A --> to fragment B --> to fragment C I can use Safe Args to pass data from fragment A to fragment B. and also using safe args from fragment B to fragment C. what if I want to bring a string…