android-architecture-navigation

Navigation Architecture Component - BottomNavigationView with Login Screen

自闭症网瘾萝莉.ら 提交于 2020-05-16 05:54:20
问题 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

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

Navigation component crash on rotate

旧时模样 提交于 2020-05-14 18:24:09
问题 Navigation component crash on the device rotate 2019-04-15 11:50:08.589 21493-21493/me.rankov.kaboom E/AndroidRuntime: FATAL EXCEPTION: main Process: me.rankov.kaboom, PID: 21493 java.lang.IllegalArgumentException: navigation destination me.rankov.kaboom:id/actionHomeToCountry is unknown to this NavController at androidx.navigation.NavController.navigate(NavController.java:803) at androidx.navigation.NavController.navigate(NavController.java:744) at androidx.navigation.NavController.navigate

How to switch to other fragment in different back stack using Navigation Component?

陌路散爱 提交于 2020-05-12 13:57:09
问题 I have 3 bottom navigation tabs called Home, Dashboard, Profile . In Home , I have Fragment1 and Fragment2 , In Dashboard , I have Fragment3 and Fragment4 And in Profile , I have MyProfile and EditProfile . Now, in Fragment2 , a button changeAvatar can open EditProfile in stack Profile . Because EditProfile should be in tab Profile , so if I don't want to include EditProfile into navGraph of Home , how can I achieve that behavior? 回答1: try with the deep link Navigation graph. <navigation ...>

How to switch to other fragment in different back stack using Navigation Component?

╄→尐↘猪︶ㄣ 提交于 2020-05-12 13:56:28
问题 I have 3 bottom navigation tabs called Home, Dashboard, Profile . In Home , I have Fragment1 and Fragment2 , In Dashboard , I have Fragment3 and Fragment4 And in Profile , I have MyProfile and EditProfile . Now, in Fragment2 , a button changeAvatar can open EditProfile in stack Profile . Because EditProfile should be in tab Profile , so if I don't want to include EditProfile into navGraph of Home , how can I achieve that behavior? 回答1: try with the deep link Navigation graph. <navigation ...>

How to set `null` as the default value for a nullable argument using SafeArgs?

試著忘記壹切 提交于 2020-05-12 11:31:25
问题 How should I pass in null as default value for a String argument such as this: <argument android:name="profile_id" android:defaultValue="???" app:argType="string" app:nullable="true" /> If the argument is nullable there should be a way to pass in null right? 回答1: Turns out the good old @null works <argument android:name="profile_id" android:defaultValue="@null" app:argType="string" app:nullable="true" /> 来源: https://stackoverflow.com/questions/53661394/how-to-set-null-as-the-default-value-for

How to set `null` as the default value for a nullable argument using SafeArgs?

核能气质少年 提交于 2020-05-12 11:31:09
问题 How should I pass in null as default value for a String argument such as this: <argument android:name="profile_id" android:defaultValue="???" app:argType="string" app:nullable="true" /> If the argument is nullable there should be a way to pass in null right? 回答1: Turns out the good old @null works <argument android:name="profile_id" android:defaultValue="@null" app:argType="string" app:nullable="true" /> 来源: https://stackoverflow.com/questions/53661394/how-to-set-null-as-the-default-value-for

Androidx Navigation View - `setNavigationItemSelectedListener` Doesn't Work

醉酒当歌 提交于 2020-05-11 04:30:10
问题 What am I doing? I have been trying to work with Androidx Navigation Drawer( <com.google.android.material.navigation.NavigationView> ). I've read the documentation Here, which says that for handling item selections we can use setNavigationItemSelectedListener . Note: I am using JetPack's Navigation Component as well. Below is: main_activity.xml <?xml version="1.0" encoding="utf-8"?> <androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app

Could Navigation Arch Component create a false positive memory leak?

£可爱£侵袭症+ 提交于 2020-05-10 07:28:06
问题 I have a basic knowledge of memory leaks and what can cause them. That's why I don't understand if I have a problem in my code or is it a false positive. I don't know which part of the code I should share since the project is not small. But just let me know in the comments and I will add required code. I use navigation arch component and follow MVVM pattern. I added LeakCanary library later in the development of project and it immediately started to give me warnings about retained instances

How do I define default animations for Navigation Actions?

巧了我就是萌 提交于 2020-05-09 19:26:13
问题 I'm using Android Studio 3.2 Canary 14 and The Navigation Architecture Component. With this you can define transition animations pretty much as you would when using Intents. But the animations are set as properties of the actions in the navigation graph, like so: <fragment android:id="@+id/startScreenFragment" android:name="com.example.startScreen.StartScreenFragment" android:label="fragment_start_screen" tools:layout="@layout/fragment_start_screen" > <action android:id="@+id/action