android-navigation-graph

Android navigation component - change root fragment?

纵饮孤独 提交于 2021-02-05 06:48:21
问题 let's say I have fragments a->b->c , but "a" is a splash screen, so I want "b" to become first fragment in stack and throw "a" forever, so when I'm i "b" and press "back" system button - I close the app In SupportFragmentManager I used replace() and that worked. But how can I achieve it here? 回答1: here is an example graph.xml <?xml version="1.0" encoding="utf-8"?> <navigation xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns

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

Deep linking from Notification - how to pass data back up through the backstack?

北战南征 提交于 2020-07-09 03:09:19
问题 In my app, the user can select a category, then select an item within that category to finally view the item details. The standard/forward flow is: SelectCategoryFragment -> SelectItemFragment -> ViewItemDetailsFragment On selecting a category, the selectedCatId is passed via a Bundle from SelectCategoryFragment to SelectItemFragment : NavController navController = Navigation.findNavController(v); Bundle args = new Bundle(); args.putLong(SelectItemFragment.ARG_CATEGORY_ID, selectedCatId);

androidx.navigation:navigation-fragment:2.2.0, get “You must call removeView() on the child's parent first.” on navController.popBackStack()

泪湿孤枕 提交于 2020-04-30 08:51:47
问题 I like use data binding and navigation graph. But after update androidx dependencies from androidx.navigation:navigation-fragment:2.0.0 on 2.2.0 application is crashed after press button "Back". Crash always after return from other fragment to previous fragment containing FragmentPagerAdapter. in build.gradle dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'androidx.constraintlayout:constraintlayout:1.1.3' // This is work // implementation 'androidx

androidx.navigation:navigation-fragment:2.2.0, get “You must call removeView() on the child's parent first.” on navController.popBackStack()

半世苍凉 提交于 2020-04-30 08:48:13
问题 I like use data binding and navigation graph. But after update androidx dependencies from androidx.navigation:navigation-fragment:2.0.0 on 2.2.0 application is crashed after press button "Back". Crash always after return from other fragment to previous fragment containing FragmentPagerAdapter. in build.gradle dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'androidx.constraintlayout:constraintlayout:1.1.3' // This is work // implementation 'androidx

Android NavigationUI startDestination class (not ID) programmatically

懵懂的女人 提交于 2020-03-04 18:57:21
问题 I need to set the start destination of a navigation graph programmatically depending on a condition. I have Fragment0, and also Fragment1, Fragment2, ... FragmentN all extending Fragment0, and being all of them (including Fragment0) able to be that wished start destination . I already know there is the method from NavGraph called setStartDestination(R.id.nav_fragment_X); but it is not useful for me because, if I am not wrong, it requires to have all these fragment0...N nodes declared in the

Android NavigationUI startDestination class (not ID) programmatically

陌路散爱 提交于 2020-03-04 18:56:49
问题 I need to set the start destination of a navigation graph programmatically depending on a condition. I have Fragment0, and also Fragment1, Fragment2, ... FragmentN all extending Fragment0, and being all of them (including Fragment0) able to be that wished start destination . I already know there is the method from NavGraph called setStartDestination(R.id.nav_fragment_X); but it is not useful for me because, if I am not wrong, it requires to have all these fragment0...N nodes declared in the

Accessing graph-scoped ViewModel of child NavHostFragment using by navGraphViewModels

南笙酒味 提交于 2019-12-13 03:35:08
问题 I am using the Navigation Component of Android Jetpack (2.2.0-alpha01). I wish to use a child NavHostFragment nested inside my main NavHostFragment, equipped with its own child nav graph. Please view the following image for context: The child nav host is defined like this inside the fragment that is at the front of the MainNavHost's stack: <fragment android:id="@+id/childNavHostFragment" android:name="androidx.navigation.fragment.NavHostFragment" android:layout_width="match_parent" android