android-architecture-navigation

Recreating backstack with Android Navigation Architecture Component

丶灬走出姿态 提交于 2020-08-22 05:12:43
问题 I am trying to implement navigation to specific Detail pages of my app using PendingIntent from a notification, however I am having problems recreating the backstack from the Detail page all the way back to the start destination. I made a sample app here with a single activity and three fragments to demo this: Fragment 1 -> Fragment 2 -> Fragment 3 (start dest) <- <- From Fragment 1 (the start destination), I navigate directly to Fragment 3 using Navigation.findNavController(this, R.id.nav

Recreating backstack with Android Navigation Architecture Component

假装没事ソ 提交于 2020-08-22 05:09:28
问题 I am trying to implement navigation to specific Detail pages of my app using PendingIntent from a notification, however I am having problems recreating the backstack from the Detail page all the way back to the start destination. I made a sample app here with a single activity and three fragments to demo this: Fragment 1 -> Fragment 2 -> Fragment 3 (start dest) <- <- From Fragment 1 (the start destination), I navigate directly to Fragment 3 using Navigation.findNavController(this, R.id.nav

Custom “navigate up” behavior for certain fragment using Navigation component

南笙酒味 提交于 2020-08-21 05:14:13
问题 I want to add custom up navigation from fragment using Navigation component In my build.gradle(app) I use androidx.appcompat:appcompat:1.1.0-alpha04 dependency to have access to onBackPressedDispatcher from activity. So I implemented OnBackPressedCallback in my fragment and registered callback to dispatcher: requireActivity().onBackPressedDispatcher.addCallback(this) I expected that pressing navigate up in toolbar will call it, but it doesn't. Pressing device's back button calls it as

Custom “navigate up” behavior for certain fragment using Navigation component

馋奶兔 提交于 2020-08-21 05:13:46
问题 I want to add custom up navigation from fragment using Navigation component In my build.gradle(app) I use androidx.appcompat:appcompat:1.1.0-alpha04 dependency to have access to onBackPressedDispatcher from activity. So I implemented OnBackPressedCallback in my fragment and registered callback to dispatcher: requireActivity().onBackPressedDispatcher.addCallback(this) I expected that pressing navigate up in toolbar will call it, but it doesn't. Pressing device's back button calls it as

Fragments not added to backstack using Navigation Components

陌路散爱 提交于 2020-08-19 04:49:23
问题 Information: I'm programmatically inserting a NavHostFragment for each feature of the app. Each NavHostFragment has it's own Navigation Graph. Dagger is providing them by using a FragmentFactory specific to each feature. It's a Single Activity structure with MVVM architecture. Repo: https://github.com/mitchtabian/DaggerMultiFeature/tree/nav-component-backstack-bug checkout the branch "nav-component-backstack-bug". The Problem When navigating into the graph the fragments are not being added to

Fragments not added to backstack using Navigation Components

我与影子孤独终老i 提交于 2020-08-19 04:49:13
问题 Information: I'm programmatically inserting a NavHostFragment for each feature of the app. Each NavHostFragment has it's own Navigation Graph. Dagger is providing them by using a FragmentFactory specific to each feature. It's a Single Activity structure with MVVM architecture. Repo: https://github.com/mitchtabian/DaggerMultiFeature/tree/nav-component-backstack-bug checkout the branch "nav-component-backstack-bug". The Problem When navigating into the graph the fragments are not being added to

How to use NavigationExtensions.kt in a Java project?

萝らか妹 提交于 2020-08-08 19:03:42
问题 I'm trying to implement NavController with BottomNavigation in a new project. This is my first attempt and there is a lot of ambiguous information all over the place about this. So my question relates to each Bottom tab having its own back stack and persisting the fragments between bottom navigation taps. Yes, I have looked at https://github.com/android/architecture-components-samples/tree/master/NavigationAdvancedSample and I'm unable to understand how to integrate this with my existing Java

How to interact with other fragment when using Navigation architecture component?

爷,独闯天下 提交于 2020-08-05 17:59:32
问题 i want to add fragment B on top of fragment A without view of fragment A getting destroyed. Only option i see in navigation library is to use navigate method to open a fragment but how to ensure fragment B is added on top of fragment A, not replaced. navigationController.navigate(R.id.B, bundle); and how to find the instance of fragment A to be able to interact with it? 回答1: Will like to know so as to clarify myself. Why don't you want fragment A be destroyed when you navigation to fragment B

How to interact with other fragment when using Navigation architecture component?

有些话、适合烂在心里 提交于 2020-08-05 17:58:45
问题 i want to add fragment B on top of fragment A without view of fragment A getting destroyed. Only option i see in navigation library is to use navigate method to open a fragment but how to ensure fragment B is added on top of fragment A, not replaced. navigationController.navigate(R.id.B, bundle); and how to find the instance of fragment A to be able to interact with it? 回答1: Will like to know so as to clarify myself. Why don't you want fragment A be destroyed when you navigation to fragment B