I am uisng Android Jetpack Navigation
framework with native java
. The thing is the compiler
automatically generates the class responsible for the actions defined in the navigation graph, with the correspondent argument setters and getters
, but it is not generating a constructor with arguments, but just an empty static constructor
.
Is there any way to make the safeArgs plugin
or the Navigation framework
create this constructors with arguments
?
my xml:
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/edicion_basica_navigation"
app:startDestination="@id/nav_A_fragment">
<fragment
android:id="@+id/nav_A_fragment"
android:name="com.fragments.A"
android:label="@string/A"
tools:layout="@layout/fragment_a">
<argument
android:name="@string/arg_id"
android:defaultValue="0"
app:argType="integer" />
<argument
android:name="@string/arg_rowid"
android:defaultValue="0"
app:argType="integer" />
</fragment>
<fragment
android:id="@+id/nav_B_fragment"
android:name="com.fragments.B"
android:label="@string/b"
tools:layout="@layout/fragment_b">
<argument
android:name="@string/arg_id"
android:defaultValue="0"
app:argType="integer" />
<argument
android:name="@string/arg_rowid"
android:defaultValue="0"
app:argType="integer" />
</fragment>
<action
android:id="@+id/A_to_B"
app:destination="@id/nav_B_fragment" />
</navigation>
Thank you