Questions tagged [android-navigation]

For questions about navigation within and between Android apps. Examples include navigating between activities/fragments, up/back behavior, task stacks, and Intent flags that affect navigation behavior.

Consistent navigation is an essential component of the overall user experience. Few things frustrate users more than basic navigation that behaves in inconsistent and unexpected ways.

Android 3.0 introduced significant changes to the global navigation behavior. Thoughtfully following the guidelines for Back and Up will make your app's navigation predictable and reliable for your users.

Android 2.3 and earlier relied upon the system Back button for supporting navigation within an app. With the introduction of action bars in Android 3.0, a second navigation mechanism appeared: the Up button, consisting of the app icon and a left-point caret.

See also the official documentation about this topic.

1192 questions
25
votes
3 answers

Navigation intent that would work with maps and waze

I'm trying to start a navigation activity with an intent from my app. I want it to start navigation from my location to a point that I provide. I've tried this way String uri = "geo: "+String.valueOf(latitude) + "," +…
RCB
  • 2,253
  • 2
  • 25
  • 49
25
votes
5 answers

Must I specify the parent activity name in the Android Manifest?

I have an activity that starts another activity. Is it mandatory that I specify the parent activity in the Android Manifest? Im asking this because there might be other activities that will start this one as well, so should I specify all of…
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
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
3 answers

Action is unknown to this NavController

I'm providing data transfer between fragments in two different ways, first is working normal, while a safe data type cause run-time crash. I'm using that Android…
24
votes
4 answers

How to enable or fake mini variant from Material Design guide for android.support.v4.widget.DrawerLayout?

How to enable the "mini variant" from the Material Design guide - so that only the Drawer icons are shown in its closed state? As a simple test project for my question I have taken the well-known Navigation Drawer Example by Google - and then added…
22
votes
3 answers

Multiple LiveData Observers After Popping Fragment

Issue Summary: Multiple LiveData Observers are being triggered in a Fragment after navigating to a new Fragment, popping the new Fragment, and returning to the original Fragment. Details: The architecture consists of MainActivity that hosts a…
22
votes
4 answers

Jetpack navigation: Title and back/up arrow in the action bar?

I have installed the latest canary version of Android Studio, and followed this (https://developer.android.com/topic/libraries/architecture/navigation/navigation-implementing) instruction to implement a simple two page navigation. Basically page1…
20
votes
2 answers

Pass arguments safely to nested graph with Navigation Component

I'm using Android Jetpack Navigation Component. I have a nested nav graph with id, say R.id.nested_graph The first Fragment of the nested graph receives one parameter.
GaRRaPeTa
  • 5,459
  • 4
  • 37
  • 61
20
votes
5 answers

Is it possible to send arguments other than string or integer in android's new navigation component

The new navigation component is great! however I would like to send "Long" variables between my fragments. writing this in the navigation graph file works: writing this…
20
votes
4 answers

How to set target fragment of a dialog when using navigation components

I'm showing a dialog inside a fragment using childFragmentManager or within an Activity using the supportFragmentManager, in the process I would like to set the target fragment, like this: val textSearchDialog =…
20
votes
3 answers

How to use android navigation without binding to UI in ViewModel (MVVM)?

I am using android navigation that was presented at Google I/O 2018 and it seems like I can use it by binding to some view or by using NavHost to get it from Fragment. But what I need is to navigate to another specific view from ViewModel from my…
20
votes
6 answers

How to implement android Toolbar Back button

I am using a custom toolbar. I need to add back button to it. Now I am using this code to add the back button. Toolbar toolbar = (Toolbar) getActivity().findViewById(R.id.toolbar); …
Zach
  • 9,989
  • 19
  • 70
  • 107
19
votes
5 answers

Android : Return to previous fragment on back press

I have implemented Navigation Drawer which is a subclass of Activity. I have many fragments in my application. My question goes here Imagine there are 3 fragments : Fragment_1 : Fragment_2 : Fragment_3 When I start my application, Fragment_1 is…
Harsh
  • 644
  • 3
  • 14
  • 27
18
votes
6 answers
1 2
3
79 80