android-architecture-navigation

Navigation Architecture Component - Dialog Fragments

孤街浪徒 提交于 2019-12-18 12:07:33
问题 Is it possible to use the new Navigation Architecture Component with DialogFragment? Do I have to create a custom Navigator? I would love to use them with the new features in my navigation graph. 回答1: No, as of the 1.0.0-alpha01 build, there is no support for dialogs as part of your Navigation Graph. You should just continue to use show() to show a DialogFragment . 回答2: May 2019 Update : DialogFragment are now fully supported starting from Navigation 2.1.0-alpha03 , you can read more here and

Android Navigation Component pop to transition issue

懵懂的女人 提交于 2019-12-18 11:53:26
问题 I have 2 actions Action1 <action android:id="@+id/actionBaseFragmentToAskForLocation" app:destination="@+id/introAskForLocationFragment" app:enterAnim="@anim/slide_in_right" app:exitAnim="@anim/slide_out_left" app:popEnterAnim="@anim/slide_in_left" app:popExitAnim="@anim/slide_out_right" /> Action2 <action android:id="@+id/actionIntroAskLocationToLogin" app:destination="@id/loginFragment" app:enterAnim="@anim/slide_in_right" app:exitAnim="@anim/slide_out_left" app:popEnterAnim="@anim/slide_in

Android JetPack navigation with multiple stack

隐身守侯 提交于 2019-12-18 11:19:09
问题 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 again, I will see root fragment in the tab A and not page C which does not what I expect. I'm looking for a solution to have a different stack for each tab, so the state of each tab is reserved when I come back to it, Also I don't like to keep all

Dynamic ActionBar title from a Fragment using AndroidX Navigation

孤街醉人 提交于 2019-12-18 11:04:31
问题 I am using the new Navigation component from Android Jetpack. The root Activity setup is quite simple: override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) setSupportActionBar(toolbar) val navController = findNavController(R.id.navigationFragment) setupActionBarWithNavController(navController) bottomNavigationView.setupWithNavController(navController) } It works well when the Fragment's title is defined in the

Android Jetpack Navigation with ViewPager and TabLayout

对着背影说爱祢 提交于 2019-12-18 10:42:54
问题 For a new app i use Jetpack Navigation Library to implement proper back navigation. The first level of navigation is a navigation drawer which works fine with jetpack navigation as described in the documentation. But there is another level of navigation implemented with ViewPager and TabLayout. The fragments switched by the TabLayout contain additional linear navigation hierarchy. However, there seems to be no support for ViewPager/TabLayout in Jetpack Navigation. A FragmentPagerAdapter has

Android navigation component: how save fragment state

て烟熏妆下的殇ゞ 提交于 2019-12-18 04:02:30
问题 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 return A. When I return to tab A, I do not want it to be re-created. How do it? Thanks 回答1: As per the open issue, Navigation does not directly support multiple back stacks - i.e., saving the state of stack B when you go back to B from A or C since

Android navigation component: how save fragment state

久未见 提交于 2019-12-18 04:01:57
问题 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 return A. When I return to tab A, I do not want it to be re-created. How do it? Thanks 回答1: As per the open issue, Navigation does not directly support multiple back stacks - i.e., saving the state of stack B when you go back to B from A or C since

Is it possible to set startDestination conditionally using Android Navigation Architecture Component(Android Jetpack)?

≯℡__Kan透↙ 提交于 2019-12-17 15:43:05
问题 I am using Navigation from Android Jetpack to navigate between screens. Now I want to set startDestination dynamically. I have an Activity named MainActivity And two Fragments, FragmentA & FragmentB. var isAllSetUp : Boolean = // It is dynamic and I’m getting this from Preferences. If(isAllSetUp) { // show FragmentA } else { //show FragmentB } I want to set above flow using Navigation Architecture Component. Currently I have used startDestionation as below but it’s not fulfilling my

java.lang.IllegalArgumentException: navigation destination xxx is unknown to this NavController

柔情痞子 提交于 2019-12-17 15:35:02
问题 I am having issue with the new Android Navigation Architecture component when I try to navigate from one Fragment to another , I get this weird error: java.lang.IllegalArgumentException: navigation destination XXX is unknown to this NavController Every other navigation works fine except this particular one. I use: findNavContoller() extension function of Fragment to get access to the navControler. Any help will be appreciated. 回答1: In my case, if the user clicks the same view twice very very

button back in startDestination with navigation component

橙三吉。 提交于 2019-12-13 15:52:32
问题 I need a second activity with a nav graph and have a return button in toolbar to the first activity that also contains a nav graph In my second activity I have onSupportNavigateUp and setupActionBarWithNavController when entering the fragments if the arrow back button appears but in the activity no. Try adding setHomeButtonEnabled and setDisplayHomeAsUpEnabled in both the activity and the fragment and if the button appears back, but when I enter some fragment in front and return to the