Questions tagged [android-safe-args]

144 questions
140
votes
10 answers

Unable to load class AndroidComponentsExtension after upgrading the Android Gradle Plugin 7.1

I recently downloaded Android Studio Bumblebee and it helpfully asked whether I wanted to upgrade to Android Gradle Plugin 7.1.0, the version that shipped alongside Android Studio Bumblebee. After upgrading, I get a build error: Unable to load class…
27
votes
9 answers

Cause: androidx.navigation.safeargs can only be used with an androidx project

I am facing issue with navigation component called safeargs. I have used classpath 'androidx.navigation:navigation-safe-args-gradle-plugin:2.0.0' in build gradle. While applying plugin androidx.navigation.safeargs.kotlin in app/build.gradle, I am…
25
votes
11 answers

Unresolved reference: NavArgs after added some arguments to destination

I'm working on a small project and trying to use the new navigation architecture components. When i'm trying to add some arguments to a destination i got "Unresolved reference: NavArgs" error. I followed this guide…
23
votes
1 answer

Parcelables don't support default values. Android navigation deeplink argument

During the implementation of the passing parameter solution, in navigation between modules, I came across a serialization error. Deeplinks, as far as I know, accepts custom argument types, which are Parcelables or Serializable. Im using newest…
Nikron
  • 470
  • 7
  • 15
22
votes
6 answers

Pass data/bundle using navigateUp in Android Navigation Component

I found the question but does not have solution in code I want to have data when backpress/manual back happens. I am using navigateUp() to go back. How can I pass data to previous fragment? navigateUp() does not have any facility to pass data to…
17
votes
3 answers

Android Navigation Component : BottomNavigationView's selected tab icon is not updated

I'm using BottomNavigationView with Navigation Component. When showing fragment is not root fragment, the tab icon is not updated (selected). Example: When I switch between Tab Home with Fragment A (which is root fragment) and Tab Star with Fragment…
Amir
  • 1,628
  • 20
  • 28
17
votes
1 answer

How to pass generic data types with Safe Args?

I need to pass Kotlin's Pair as arguments. e: CreateCodeFragmentDirections.kt: (16, 15): 2 type arguments expected for class Pair
Pitel
  • 5,334
  • 7
  • 45
  • 72
16
votes
5 answers

Can't get Root View from Data Binding after enabling safe-args plugin

I'm working on an Android app using dataBinding and am currently trying to add the safe-args plugin, but after enabling the plugin, I can no longer get the root view via binding.root - Android Studio gives the error: Unresolved Reference None of…
Hannah S.
  • 338
  • 1
  • 4
  • 11
15
votes
3 answers

How to get a default string value from resources in SafeArgs?

I'm just learning a Android NavigationUI, and try set a toolbar title using string default value from Safe Args. But have some problem about it. 'String resources' file: Add new items Navigation graph…
14
votes
3 answers

How to reuse a fragment in different navigation graphs with safe args enabled?

I'm trying to reuse a fragment in different navigation graphs with safe args enabled. I noticed that if the actions are different I get a compilation error. This is because the xxxFragmentDirections autogenerated code will only generate one of the…
13
votes
5 answers

Android navArgs clear on back

Is there a way to clear navArgs after using them? I have fragment A that opens fragment B with navArgs, then I navigate to fragment C and the user presses back, so fragment B is opened with the same navArgs and I don't want that. Is there a way to…
13
votes
1 answer

passing ArrayList as argument in safeArgs

I'm trying to pass an ArrayList as an argument while using safeArgs. But when I select ArrayList from the list of serializable and build, it is throwing me these exceptions One type argument expected for class ArrayList One type…
12
votes
4 answers

Android SafeArgs generated action is missing arguments

My project uses SafeArgs. I've switched to a branch that someone else created, and building the project generates a compiler error, because the generated "~Directions" class' methods for return ActionOnlyNavDirections (no arguments passed to…
duggulous
  • 2,427
  • 3
  • 23
  • 40
12
votes
3 answers

Why is android studio not generating code for all the safe args?

I am using safe-args to pass arguments from one fragment to the other. Android studio intermittently generates the fragmentArgs class with all the arguments. What I have tried, and does work, is altering the nav graph file, making the project, then…
wamae
  • 660
  • 9
  • 21
11
votes
1 answer

Required argument "name" is missing and does not have an android:defaultValue

I'm having a problem with my code i'm trying to pass arguments between fragments but it gives an exception java.lang.IllegalArgumentException: Required argument "name" is missing and does not have an android:defaultValue when run it. Im still still…
1
2 3
9 10