Questions tagged [android-architecture-navigation]

The Navigation Architecture Component provides a framework for in-app navigation for Android apps.

The Navigation Architecture Component is released as a part of Android JetPack and AndroidX package. It simplifies the navigation implementation in Android Apps. Its goal is to provide consistent and predictable experience to the end users, with single Activity Architecture. It also has support for Fragments and Deep-links. It has Navigation graph at the core of the library. Navigation Graph describes how the activities and fragments are related to each other and how the transition will work.

1346 questions
26
votes
3 answers

What is the correct way to pass an Enum as an argument to a Fragment using Navigation Component safeargs

The documentation discusses how to send simple integers and strings. For example: In the origin Fragment: val action =…
JHowzer
  • 3,684
  • 4
  • 30
  • 36
26
votes
2 answers

How to Start Second Activity with Navigation in Jetpack

You know It's official now: Google officially recommends single activity app architecture. But there is a difficulty here. We have multiple activities. So when I want to implement Navigation with multiple activities, but I failed. They said: In…
25
votes
8 answers

How to animate Android Navigation Architecture fragment as sliding over old fragment?

In example navigation action defined in navigation graph: When…
25
votes
3 answers

Navigation Library inflator throws ClassNotFoundException for data class

In the Navigation Library version alpha09+ (using alpha11) I am experiencing a ClassNotFoundException for one of my data classes which I defined as an argType in my navigation graph. app:argType="com.package.app.data.model.user.User.Full" This…
25
votes
3 answers

How to pass arguments to a fragment using bottom navigation view and Android Navigation component?

Is it possible to pass and access arguments in a fragment using a bottom navigation view and the Navigation component? I'm using a one activity with many fragments approach where my top level fragment requires an argument(Usually done via the…
25
votes
1 answer

How do I link multiple activities in android navigation editor?

I'm learning android development and the navigation component, trying to link multiple activities as the document had written. But it seems like it's impossible to create action between two activities to a single navigation graph which was…
Jian
  • 3,118
  • 2
  • 22
  • 36
24
votes
5 answers

how to setup different toolbar using navigation controller component?

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…
24
votes
3 answers

Android jetpack navigation component result from dialog

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.…
SMGhost
  • 3,867
  • 6
  • 38
  • 68
24
votes
2 answers

Pass data from single activity to start destination fragment using Architecture Component Navigation

I've got the following Activity, which is the single one in my app: MainActivity.java: public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { PermissionState state =…
24
votes
11 answers

Keeping states of recyclerview in fragment with paging library and navigation architecture component

I'm using 2 components of the jetpack: Paging library and Navigation. In my case, I have 2 fragment: ListMoviesFragment & MovieDetailFragment when I scroll a certain distance and click a movie item of the recyclerview, MovieDetailFragment is…
24
votes
3 answers

Navigation with MVVM android

I have an app using Androids ViewModel class and Navigation Component for navigating between fragments. How would I handle navigation from the ViewModel? I am using RxJava and I was thinking of having the Fragments listen for navigation events and…
24
votes
9 answers

Could not find androidx.navigation:safe-args-gradle-plugin:1.0.0-alpha01

I want to use Navigation Architecture Components. But I got a problem with importing safeargs Sync message: Could not find androidx.navigation:safe-args-gradle-plugin:1.0.0-alpha01. Searched in the following…
ibocon
  • 1,352
  • 3
  • 17
  • 40
23
votes
2 answers

Android Navigation Component has lag when navigating through NavigationDrawer

I am updating my app to Navigation Architecture Components and I see that it has a lag replacing fragments which is visible in the NavigationDrawer that does not close smoothly. Until now, I was following this…
23
votes
2 answers

Android Navigation Component: Start at a different destination than home, programmatically?

I'm trying to implement a multiple navigation controller with multiple back stack BottomNavigationView, as per the github examples. However, the example uses a different nav graph for each tab, which makes things easy. In my case I need to use the…