Questions tagged [android-safe-args]

144 questions
1
vote
1 answer

Sending argument to Fragment from Activity using NavigationComponent and SafeArgs with the same name reference

I have a case here that I have to open a Fragment from an Activity and I did it sometimes but the issue here that I wanna open the Fragment that has an argument with it.
1
vote
1 answer

Using Navigation's actions instead of direct fragment id crashes app

I'm having an issue with a very simple task with Navigation component. I have just 2 screens: MainFragment and SearchFragment. When I try to go from MainFragment to SearchFragment by navigation with an action it works perfectly. Then I press the…
1
vote
3 answers

How to use Navigation Safe Args with Kotlinx serializable data

I'm trying to use Navigation Safe Args with Kotlinx @Serializable types, but I keep getting the same issue during run-time when I pass the serializable data: Caused by: java.lang.IllegalArgumentException:…
1
vote
0 answers

Android Kotlin Safe-Args Navigating back to Fragment without passing arguments again

For easiest explanation I have 3 fragments. The first fragment the user will enter languages they want to learn and this data is then passed to the next fragment to update the titles of the table to the current languages. This part I have managed to…
jhouston98
  • 21
  • 4
1
vote
1 answer

How to use Safeargs with multiple navGraphs

I am creating an app for a school assignment where I need to use 2 activities, which both have a navGraph with multiple fragments. I know how to pass data between the fragments, but I need to pass data from the userActivity to the mainActivity using…
1
vote
1 answer

Android: Fragment has null arguments when getting global nested safeargs

I am trying to get my safeargs within the second fragment (calibrateRepairOptionFragment) of my nested_graph, The problem is that I get the above written error Fragment CalibrateRepairOptionFragment{5e1268d} (c7c2906d-5a17-4d22-b41d-eefe8eee059f)…
1
vote
0 answers

Create a form where you can have several child fragments that send data back to the main fragment Kotlin

I’m new to kotlin and I am having a hard time trying to create a form in my app. The form uses a main fragment where you can click on different attributes where it opens a new fragment, where you can insert data. When you are done filling in the…
1
vote
1 answer

Clashing class and package when using Android Safe Args

I'm struggling with a really annoying problem with Safe Args in Android (Java). I have a project structure like this: com.myapp/ ├── activites/ │ ├── ActivityA.java | | ├── FragmentA1 | │ └── FragmentA2 │ └── ActivityB.java ├── view/ | …
woernsn
  • 11
  • 3
1
vote
2 answers

fragment arguments are null using launchFragmentInContainer

I am writing a test for a fragment that uses safeArgs and FragmentScenario, however when I call launchFragmentInContainer() with the fragmentArgs parameter, I get an exception saying the arguments are null. There is no problem in production code. My…
1
vote
1 answer

Android send ViewModel to Fragment via NavDirections arguement (Safe-Args)

I have an app with the following architecture: Navigator is a custom class that holds the NavController Cooridnator holds the Navigator Cooridnator tells the Navigator to "start" the framgent and passes the ViewModel to it Navigator asks…
1
vote
1 answer

How to use SafeArgs with destination that appears more than once in navigation graph?

I had the main navigation of my app set up nicely using SafeArgs. This was my nav_graph.xml:
1
vote
0 answers

Android Jetpack Safe Args Issue

I have an app which has one main activity and 3 fragments. Let's name them A, B and C as shown below: Fragment A has a RecyclerView. When i click on an item in the RecyclerView, it passes an Account object in safe args to the Fragment B where it…
1
vote
2 answers

Problem with passing data between fragments with SafeArgs

I want to pass a string from one fragment to another. The problem is that my HomeFragmentDirections class says that an action I want to get "has private access". Nav_graph.xml:
1
vote
0 answers

(FragmentDirections Class), GameFragmentDirections(In this case) not generated while using safe args

I am trying to navingate from GameFragment to GameWonFragment using Safe Args. But GameFragmentDirections class didn't generated.
1
vote
2 answers

SafeArgs NavController Android gradle plugin update to 2.2.0 error

I was recently updating my App dependencies and when trying to update the safeargs navigation component gradle plugin to 2.2.1 (actually happens with 2.2.0 too) like this: dependencies { classpath…