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
63
votes
13 answers

Navigation component Kotlin - cannot be found from the current destination

I have a fragment A,B,C. Its okay when navigating from A -> B, but from B -> C it crashes. Here is my Navigation Here is my navigation code categoryProductItemListAdapter.setOnItemClickListener { val action =…
Cyd
  • 1,245
  • 1
  • 14
  • 17
59
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
  • 5,360
  • 6
  • 38
  • 60
59
votes
10 answers

How I can retrieve current fragment in NavHostFragment?

I tried to find a method in the new Navigation components but I didn't find anything about that. I have the current destination with : mainHostFragment.findNavController().currentDestination But I can't get any reference to the displayed fragment.
58
votes
19 answers

How to set title in app bar with Navigation Architecture Component

I was trying out Navigation architecture component and is now having difficulties in setting the title. How do I set the title programmatically and also how it works? To clear my question, let's have an example, where, I've set up a simple app with…
57
votes
6 answers

How do I define default animations for Navigation Actions?

I'm using Android Studio 3.2 Canary 14 and The Navigation Architecture Component. With this you can define transition animations pretty much as you would when using Intents. But the animations are set as properties of the actions in the navigation…
55
votes
3 answers

What is the difference between enterAnim & popEnterAnim & exitAnim & popExitAnim?

What is the difference between animation tags in latest Navigation Architecture Component? I got confused with enterAnim & popEnterAnim. Similarly, exitAnim & popExitAnim. Any visual expansions is more than welcomed.
musooff
  • 6,412
  • 3
  • 36
  • 65
55
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
  • 8,093
  • 5
  • 43
  • 71
53
votes
7 answers

Android navigation component: how save fragment state

I use bottomNavigationView and navigation component. Please tell me how I don't destroy the fragment after switching to another tab and return to the old one? For example I have three tabs - A, B, C. My start tab is A. After I navigate to B, then…
Nikitc
  • 795
  • 1
  • 6
  • 12
50
votes
1 answer

How to set `null` as the default value for a nullable argument using SafeArgs?

How should I pass in null as default value for a String argument such as this: If the argument is nullable there should be a…
Kayvan N
  • 8,108
  • 6
  • 29
  • 38
48
votes
5 answers

Proguard causing runtime exception with Android Navigation Component

I'm experiencing this crash when using proguard after integrating the NavigationComponent (android.arch.navigation:navigation-fragment-ktx:1.0.0-alpha01) into my project with target and compile sdk of 27 2018-05-16 12:13:14.044…
46
votes
1 answer

How to create BottomSheetDialogFragment using Navigation Architecture Component?

I am using BottomSheetDialogFragment for displaying few custom setting's. Requirement: When i click on any tab in BottomSheetDialogFragment i replace the fragment and add it to backstack so that when user click's onBackPress or Up action it should…
45
votes
1 answer

Could Navigation Arch Component create a false positive memory leak?

I have a basic knowledge of memory leaks and what can cause them. That's why I don't understand if I have a problem in my code or is it a false positive. I don't know which part of the code I should share since the project is not small. But just let…
45
votes
5 answers

Pass data back to previous fragment using Android Navigation

I've started using Android Architecture Components (Navigation and Safe Args, View Models) along with Koin library. Currently, I've got a problem with passing arguments between two fragments - I need to pass a string value from fragment A to…
42
votes
11 answers

Android Navigation Component : Pass value (arguments) in fragments

What I have done: I have created Navigation Drawer Activity, As updated new format of Navigation Drawer Activity, As per new Android architecture, I got it with Navigation Component structure. The NavigationView code with NavController and…
Pratik Butani
  • 60,504
  • 58
  • 273
  • 437
39
votes
5 answers

Navigation Architecture Component - Splash screen

I would like to know how to implement splash screen using Navigation Architecture Component. Till now I have something like this A user has to setup his profile in ProfileFragment for the first time and can edit their profile from ChatFragment. My…
1
2
3
89 90