android-architecture-navigation

How to pass a List as an argument to a Fragment using Navigation Component safeargs

て烟熏妆下的殇ゞ 提交于 2020-07-20 09:42:51
问题 The documentation discusses how to send simple integers and strings. For example: <argument android:name="myIntArg" android:defaultValue="255" app:argType="integer" /> In the origin Fragment: val action = OriginFragmentDirections.myAction(myInt) findNavController().navigate(action) In the destination Fragment: val receivedInt = DestinationFragmentArgs.fromBundle(arguments).myIntArg But say instead of myIntArg , I wanted to send a list of integers ( myIntListArg ). How would I do that? What

Navigation DESTINATION_NAME is unknown to this NavController, ReOpening fragment previously closed using navController.popBackStack()?

允我心安 提交于 2020-07-18 10:19:12
问题 I am using Navigation Component in my app , recently it was working correctly but after updating project to AndroidX I am getting error navigation destination DESTINATION_NAME is unknown to this NavController only if that destination(Which I'm going to open) is previously closed from itself using navController.popBackStack() . Also, There is no error if I close DESTINATION fragment from MainActivity , But Error only Occurs fragment is closed from itself using popBackStack . like below

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);

Android jetpack navigation component result from dialog

不打扰是莪最后的温柔 提交于 2020-07-05 07:39:33
问题 So far I'm successfully able to navigate to dialogs and back using only navigation component. The problem is that, I have to do some stuff in dialog and return result to the fragment where dialog was called from. One way is to use shared viewmodel. But for that I have to use .of(activity) which leaves my app with a singleton taking up memory, even when I no longer need it. Another way is to override show(fragmentManager, id) method, get access to fragment manager and from it, access to

Android jetpack navigation component result from dialog

时光总嘲笑我的痴心妄想 提交于 2020-07-05 07:39:32
问题 So far I'm successfully able to navigate to dialogs and back using only navigation component. The problem is that, I have to do some stuff in dialog and return result to the fragment where dialog was called from. One way is to use shared viewmodel. But for that I have to use .of(activity) which leaves my app with a singleton taking up memory, even when I no longer need it. Another way is to override show(fragmentManager, id) method, get access to fragment manager and from it, access to

Null NavHostFragment/NavController with FragmentContainerView

匆匆过客 提交于 2020-06-16 20:02:01
问题 Expected Create bottom app bar navigation using Navigation UI's BottomNavigationView and FragmentContainerView similar to the sample app NavigationAdavancedSample . Note, NavigationAndvancedSample app does not appear to use the same implementation as described in the documentation as it has a workaround implementation using the custom extension method setupWithNavController . Observed Null NavHostFragment when creating the BottomNavigationView in the MainActivity.kt with a

Null NavHostFragment/NavController with FragmentContainerView

不羁岁月 提交于 2020-06-16 19:57:09
问题 Expected Create bottom app bar navigation using Navigation UI's BottomNavigationView and FragmentContainerView similar to the sample app NavigationAdavancedSample . Note, NavigationAndvancedSample app does not appear to use the same implementation as described in the documentation as it has a workaround implementation using the custom extension method setupWithNavController . Observed Null NavHostFragment when creating the BottomNavigationView in the MainActivity.kt with a

java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState caused by launchFragmentInContainer

六月ゝ 毕业季﹏ 提交于 2020-06-12 05:39:26
问题 I am trying to test the app workflow. The navigation component has been used to define the app workflow. Have used FragmentScenario for testing the navigation from one fragment to another based on this reference(https://developer.android.com/guide/navigation/navigation-testing). Have added the following dependency in build.gradle debugImplementation("androidx.fragment:fragment-testing:1.1.0-beta01") { exclude group: 'androidx.test', module: 'core' } for accessing the api

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

℡╲_俬逩灬. 提交于 2020-06-08 03:30:09
问题 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. 回答1: The Animate transitions between destinations documentation details the four types of animations: Entering a destination Exiting a destination Entering a destination via a pop action Exiting a destination via a pop action "Entering" refers to the destination that is coming

Navigation Architecture Component - BottomNavigationView with Login Screen

徘徊边缘 提交于 2020-05-16 05:56:11
问题 I have my MainActivity setup which looks like this : <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".ui.host.HostActivity"> <fragment android:id="@+id/mainNavigationFragment" android:name="androidx.navigation.fragment.NavHostFragment" android