我正在使用带有安全参数的 android 导航组件。我将参数设置为可以为空,默认值也为空。
问题是当我想传递任何值时会显示错误:
required: no arguments
found: Character
reason: actual and formal argument lists differ in length
我的片段 XML 代码:
<fragment
android:id="@+id/bookListFragment"
android:name="com.example.bookstory.UI.Fragments.BookListFragment"
android:label="fragment_book_list"
tools:layout="@layout/fragment_book_list">
<argument
android:name="character"
app:argType="com.example.bookstory.DAO.Character"
app:nullable="true"
android:defaultValue="@null" />
</fragment>
我的行动:
<action
android:id="@+id/action_bookDescriptionFragment_to_bookListFragment"
app:destination="@id/bookListFragment"
app:popUpTo="@id/bookListFragment"
app:popUpToInclusive="true" />
我不明白问题出在哪里 - 当我删除默认值时就可以了。