android-navigation

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

The first item in the BottomNavigationView keep highlight when I select other item

时光怂恿深爱的人放手 提交于 2020-08-08 03:58:06
问题 The first item in the navigation bar keep highlighting. When I click other item on the navigation bar, the content will change but the corresponding item will not be highlighted, just keep highlighting the first item. bottomNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(@NonNull MenuItem item) { Fragment fragment=null; switch (item.getItemId()){ case R.id.number: fragment=new

how to setup different toolbar using navigation controller component?

孤人 提交于 2020-08-01 16:45:59
问题 I am actually not sure, how the correct way or the best practice to set different toolbar using navigation controller component in my app. I want to set 2 different toolbars. green toolbar red toolbar two toolbars with different colour. this is just to simplify the case, actually I have multiple toolbars I am using navigation controller component. and currently on my Main Activity as the host, I set the green toolbar in my main activity using this code setSupportActionBar(green_toolbar)

Safeargs library doesnt generate direction class

天涯浪子 提交于 2020-07-17 09:20:54
问题 I use navigation library and safeargs for passing data. I define argument to fragment like that. <fragment android:id="@+id/otherFragment" android:name="com.asd.navigate.OtherFragment" android:label="OtherFragment"> <argument android:name="screenTitle" android:defaultValue="0" app:type="string" /> </fragment> OtherFragmentArgs generated, I can use it but OtherFragmentDirection class doesnt generate when I click "make project". Is that bug or I have to do something different. Thnx for advice.

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

NavigationDrawer with Activities vs. NavigationDrawer with Fragments

半世苍凉 提交于 2020-06-07 09:28:46
问题 Take for example the app I'm currently working on: - it has an navigationDrawer with multiple items; there are two items which interest me for now, i'll call them X and Y. both X and Y, when clicked on, display a fragment containing a list of x-elements or y-elements selecting and x or y list element displays a new fragment in which I display info about the select item; the view fragments are different for x and y elements in the view fragment I can choose to edit the specific element which

Android Navigation Component + Login Flow + Nested BottomNavigationView

流过昼夜 提交于 2020-05-25 04:49:04
问题 I'm struggle building a Navigation, like on the image below, with the Android Navigation Component. I need a "Login Flow", check if the user is logged in and then navigate to the main part of the app (also clearing the backstack). The main part contains a BottomNavigationView with three tabs. But if I click on a settings icon on the toolbar, I also want to display a fullscreen SettingsFragment. Did I need two NavHostFragments with separate navigation graphs? If yes, how can I combine them and

Is it possible to change up button icon in Navigation Component?

给你一囗甜甜゛ 提交于 2020-05-15 06:53:05
问题 I would like to change up button icon in ActionBar that is working with Navigation Component. I've tried several options like: supportActionBar?.setHomeAsUpIndicator(R.drawable.ic_arrow_left_blue_24dp) in MainAcitivty or app:navigationIcon="@drawable/ic_arrow_left_blue_24dp" in Toolbar .xml file and nothing seems to work. I have a pretty standard setup with setSupportActionBar(appToolbar.toolbar) setupActionBarWithNavController(this, navController) called in MainActivity:onCreate method. I

can I send nullable data type as argument using safeargs ? if not what should I do?

南楼画角 提交于 2020-04-30 06:26:25
问题 say I have 2 fragments. Login and Home. I set Home fragment as a global destination that has userData as arguments if the user is not logged in yet, then it will start from login fragment. after login and get userData from server then it will navigate to Home and pass userData using this code val home = AuthenticationFragmentDirections.actionGlobalHomeFragment(userData) Navigation.findNavController(view).navigate(home, navOptions) but the problem is when the user already login and open the