Questions tagged [android-safe-args]
144 questions
3
votes
3 answers
How do I fix `Navigation action/destination cannot be found from the current destination Destination` error in my case?
I am using bottom navigation.
In the switched screen, there is also a function to open a dialog fragment.
I also used navigation for this.
This is because, as soon as this dialog is finished, data must be delivered to the screen that opened the…

ybybyb
- 1,385
- 1
- 12
- 33
3
votes
1 answer
fragmentDirections.action() method can't find arguments specified on nav_graph
I'm trying to implement the Safe Args plugin, but my auto-generated class/method MainScreenFragmentDirections.actionMainScreenFragmentToNoteScreenFragment() can't seem to find the specified arguments from the nav_graph. I don't think the problem is…

jfransp
- 85
- 7
3
votes
5 answers
The use of safeArgs in Android Studio is causing an error and I cannot build the project
I am trying to build my project in Kotlin and I am getting this error:
Execution failed for task ':app:generateSafeArgsDebug'.
Could not read 'F:\Program Files\Android…

Eleftheria P
- 41
- 1
- 5
3
votes
1 answer
How to safeargs in viewModel Kotlin Android?
I have a problem with my MVVM structure. I create apps and pass data between fragments. Now it works fine, but I need to add this logic to my ViewModel.
This is my NotesClickFragment:
@AndroidEntryPoint
class NotesClickFragment :…

siwus1230
- 31
- 2
3
votes
0 answers
NullPointerException with navigation component's argument with defaultValue
I've encountered into a strange situation. Maybe someone has an idea why this can happen.
I've added one argument to the MyActivity in main_graph.xml - isRecommended - with a default value (false):

Ksenia
- 3,453
- 7
- 31
- 63
3
votes
1 answer
Navigation safeArgs fails to navigate after back from dialog
I'm getting Illegal argumentException: Navigation action/destination pkgname:id/action_nav_home_to_dialog cannot be found from the current destination Destination(pkgname:id/dialog) when navigate from HomeFragment to other fragment using safeArgs…

kyane
- 348
- 1
- 11
3
votes
2 answers
Android Databinding error in compilation with nullable parcelable argument
I want to pass a Parcelable class Payment, that I created, from one fragment to another with safe args, but it can be null.
I created the argument of type com.example.Payment and make it nullable. When I compile the app I get an error saying…

LopsemPyier
- 671
- 1
- 6
- 13
3
votes
1 answer
When I add the same fragment to second navigation graph, don´t recognize the Action Class
I need to add the same fragment to different navigation graphs. This is piece of code of first graph (mobile_navigation)

Marcos Melgosa Vázquez
- 120
- 1
- 11
3
votes
1 answer
Navigate from fragment of one graph to fragment of another graph with bundle
I have two graphs nav_graph1.xml and nav_graph2.xml(in two different modules/lib)
I want to navigate from fragment1 to fragment2 with bundles. How do i achieve using navigation component?
nav_graph1.xml

Ananth
- 115
- 3
- 18
3
votes
4 answers
safeargs argument not found in NavDirections
I have implemented an argument to be passed between fragments in nav_graph, however when I attempt to set the argument in the originating fragment, the argument is not found by the NavDirections.
Note that Navigation works fine before trying to pass…

jcbird
- 31
- 1
- 8
3
votes
2 answers
How to use safe-args with MPP serializable data
I'm trying to use safe-args with kotlin-multiplatform types, however I keep geting the same issue during run-time when trying to pass serializable data:
Caused by: java.lang.IllegalArgumentException:
org.kotlin.mpp.mobile.models.MyModel is not…

Lucho
- 1,455
- 1
- 13
- 25
3
votes
1 answer
Exception Inflating nav_graph when passing Parcelable object between Navigation Fragments
I'm attempting to pass an object between navigation fragments. I'm able to build the project, but when it launches, I get an error on the nav_graph stating: "Exception inflating nav_graph line 20". Line 20 is the argument line on the nav_graph. I…

Jay
- 614
- 5
- 22
3
votes
5 answers
Using safeargs I get "required Bundle found Bundle?"
I am passing arguments using safeargs. In the reciving fragment I am getting a compile error: 'Required Bundle Found Bundle?'. Cannot see where the error has crept in.
Googled around, checked text and udacity tutorial
Where error appears (at…

Kevin Amor
- 51
- 1
- 6
2
votes
1 answer
How may I fix android's databinding not recognizing some views contained in the xml file?
I've recently cloned an old project and to my surprise 2 fragments had issues with data binding.
1.
As you can see on the picture: Ive declared the binding variable(34), and initialized it accordingly(46).
2.
As seen on this function, some views…

Doilio Matsinhe
- 2,131
- 16
- 29
2
votes
1 answer
Can I change the access modifier of generated safe nav args?
I am using safe nav args in my application. The point is that I have an internal class that should be passed from fragment A to fragment B. Both fragments are internal as well. The generated safe args class is public so I get that error.
'public'…

Nour El-Deen Abou El-Kassem
- 117
- 2
- 10